mirror of
https://github.com/Disassembler0/Win10-Initial-Setup-Script.git
synced 2026-01-12 07:28:29 -05:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f830a46fa9 | ||
|
|
544e15aefc | ||
|
|
436e708a1f | ||
|
|
e4a24bf83d | ||
|
|
771a32db0d | ||
|
|
5ccc376764 | ||
|
|
ef8b490da8 | ||
|
|
08ce664a37 | ||
|
|
c511b60739 | ||
|
|
27157fef8f | ||
|
|
9e4ad4215b | ||
|
|
baa547cbd8 | ||
|
|
503b1a2826 | ||
|
|
3a0ff06a81 | ||
|
|
0438564bfe | ||
|
|
0d15efc24d | ||
|
|
db2c2d54d9 | ||
|
|
efb89f42c2 | ||
|
|
4d28393ac0 |
@@ -1,7 +1,7 @@
|
||||
##########
|
||||
# Win10 / WinServer2016 Initial Setup Script - Default preset
|
||||
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Default preset
|
||||
# Author: Disassembler <disassembler@dasm.cz>
|
||||
# Version: v3.1, 2018-10-04
|
||||
# Version: v3.3, 2018-10-22
|
||||
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
|
||||
##########
|
||||
|
||||
@@ -41,6 +41,7 @@ SetCurrentNetworkPrivate # SetCurrentNetworkPublic
|
||||
# SetUnknownNetworksPrivate # SetUnknownNetworksPublic
|
||||
# DisableNetDevicesAutoInst # EnableNetDevicesAutoInst
|
||||
# DisableFirewall # EnableFirewall
|
||||
# HideDefenderTrayIcon # ShowDefenderTrayIcon
|
||||
# DisableDefender # EnableDefender
|
||||
# DisableDefenderCloud # EnableDefenderCloud
|
||||
# EnableCtrldFolderAccess # DisableCtrldFolderAccess
|
||||
@@ -102,6 +103,7 @@ DisableNewAppPrompt # EnableNewAppPrompt
|
||||
# SetControlPanelSmallIcons # SetControlPanelLargeIcons # SetControlPanelCategories
|
||||
DisableShortcutInName # EnableShortcutInName
|
||||
SetVisualFXPerformance # SetVisualFXAppearance
|
||||
# EnableDarkTheme # DisableDarkTheme
|
||||
# AddENKeyboard # RemoveENKeyboard
|
||||
# EnableNumlock # DisableNumlock
|
||||
# SetSoundSchemeNone # SetSoundSchemeDefault
|
||||
|
||||
25
README.md
25
README.md
@@ -11,7 +11,7 @@
|
||||
|
||||
## Description
|
||||
|
||||
This is a PowerShell script for automation of routine tasks done after fresh installations of Windows 10 and Windows Server 2016. This is by no means any complete set of all existing Windows tweaks and neither is it another "antispying" type of script. It's simply a setting which I like to use and which in my opinion make the system less obtrusive.
|
||||
This is a PowerShell script for automation of routine tasks done after fresh installations of Windows 10 and Windows Server 2016 / 2019. This is by no means any complete set of all existing Windows tweaks and neither is it another "antispying" type of script. It's simply a setting which I like to use and which in my opinion make the system less obtrusive.
|
||||
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ The script supports command line options and parameters which can help you custo
|
||||
**Q:** Which versions and editions of Windows are supported?
|
||||
**A:** The script aims to be fully compatible with the most up-to-date 64bit version of Windows 10 receiving updates from semi-annual channel, however if you create your own preset and exclude the incompatible tweaks, it will work also on LTSB/LTSC and possibly also on 32bit systems. Vast majority of the tweaks will work on all Windows editions. Some of them rely on group policy settings, so there may be a few limitations for Home and Education editions.
|
||||
|
||||
**Q:** Can I run the script on Windows Server 2016?
|
||||
**A:** Yes. Starting from version 2.5, Windows Server 2016 is supported. There are even few tweaks specific to Server environment. Keep in mind though, that the script is still primarily designed for Windows 10, so you have to create your own preset for Windows Server 2016.
|
||||
**Q:** Can I run the script on Windows Server 2016 or 2019?
|
||||
**A:** Yes. Starting from version 2.5, Windows Server is supported. There are even few tweaks specific to Server environment. Keep in mind though, that the script is still primarily designed for Windows 10, so you have to create your own preset.
|
||||
|
||||
**Q:** Can I run the script on Windows 7, 8, 8.1 or other versions of Windows?
|
||||
**A:** No. Although some tweaks may work also on older versions of Windows, the script is developed only for Windows 10 and Windows Server 2016. There are no plans to support older versions.
|
||||
**A:** No. Although some tweaks may work also on older versions of Windows, the script is developed only for Windows 10 and Windows Server 2016 / 2019. There are no plans to support older versions.
|
||||
|
||||
**Q:** Can I run the script in multi-user environment?
|
||||
**A:** Yes, to certain extent. Some tweaks (most notably UI tweaks) are set only for the user currently executing the script. As stated above, the script can be run repeatedly; therefore it's possible to run it multiple times, each time as different user. Due to the nature of authentication and privilege escalation mechanisms in Windows, most of the tweaks can be successfully applied only by users belonging to *Administrators* group. Standard users will get an UAC prompt asking for admin credentials which then causes the tweaks to be applied to the given admin account instead of the original non-privileged one. There are a few ways how this can be circumvented programmatically, but I'm not planning to include any as it would negatively impact code complexity and readability. If you still wish to try to use the script in multi-user environment, check [this answer in issue #29](https://github.com/Disassembler0/Win10-Initial-Setup-Script/issues/29#issuecomment-333040591) for some pointers.
|
||||
@@ -66,8 +66,8 @@ The script supports command line options and parameters which can help you custo
|
||||
**Q:** For how long are you going to maintain the script?
|
||||
**A:** As long as I use Windows 10.
|
||||
|
||||
**Q:** I really like the script. Is there any way to express gratitude and send a donation?
|
||||
**A:** Feel free to send donations via [PayPal donation link](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=disassembler%40dasm%2ecz&item_name=Disassembler&no_shipping=1). Any amount is appreciated, just be aware that PayPal charges [mediation fees](https://www.paypal.com/selfhelp/article/FAQ690). Also be aware that donations are completely voluntary and I'm not obliged to make any script adjustments in your favor regardless of the donated amount.
|
||||
**Q:** I really like the script. Can I send a donation?
|
||||
**A:** Feel free to send donations via [PayPal](https://www.paypal.me/Disassembler). Any amount is appreciated, but keep in mind that donations are completely voluntary and I'm not obliged to make any script adjustments in your favor regardless of the donated amount. You can also drop me a mail to discuss an alternative way.
|
||||
|
||||
|
||||
|
||||
@@ -87,16 +87,19 @@ The script supports command line options and parameters which can help you custo
|
||||
|
||||
## Advanced usage
|
||||
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File Win10.ps1 [-include filename] [-preset filename] [tweakname]
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File Win10.ps1 [-include filename] [-preset filename] [[!]tweakname]
|
||||
|
||||
-include filename load module with user-defined tweaks
|
||||
-preset filename load preset with tweak names to apply
|
||||
tweakname apply tweak with this particular name
|
||||
!tweakname remove tweak with this particular name from selection
|
||||
|
||||
### Presets
|
||||
|
||||
The tweak library consists of separate idempotent functions, containing one tweak each. The functions can be grouped to *presets*. Preset is simply a list of function names which should be called. Any function which is not present or is commented in a preset will not be called, thus the corresponding tweak will not be applied. In order for the script to do something, you need to supply at least one tweak library via `-include` and at least one tweak name, either via `-preset` or directly as command line argument.
|
||||
|
||||
The tweak names can be prefixed with exclamation mark (`!`) which will instead cause the tweak to be removed from selection. This is useful in cases when you want to apply the whole preset, but omit a few specific tweaks in the current run. Alternatively, you can have a preset which "patches" another preset by adding and removing a small amount of tweaks.
|
||||
|
||||
To supply a customized preset, you can either pass the function names directly as arguments.
|
||||
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File Win10.ps1 -include Win10.psm1 EnableFirewall EnableDefender
|
||||
@@ -110,7 +113,7 @@ Example of a preset file `mypreset.txt`:
|
||||
|
||||
# UI tweaks
|
||||
ShowKnownExtensions
|
||||
ShowHiddenFiles # Only hidden, not system
|
||||
ShowHiddenFiles # Only hidden, not system
|
||||
|
||||
Command using the preset file above:
|
||||
|
||||
@@ -142,9 +145,9 @@ Command using the script above:
|
||||
All features described above can be combined. You can have a preset which includes both tweaks from the original script and your personal ones. Both `-include` and `-preset` options can be used more than once, so you can split your tweaks into groups and then combine them based on your current needs. The `-include` modules are always imported before the first tweak is applied, so the order of the command line parameters doesn't matter and neither does the order of the tweaks (except for `RequireAdmin`, which should always be called first and `Restart`, which should be always called last). It can happen that some tweaks are applied more than once during a singe run because you have them in multiple presets. That shouldn't cause any problems as the tweaks are idempotent.
|
||||
Example of a preset file `otherpreset.txt`:
|
||||
|
||||
InstallLinuxSubsystem
|
||||
MyTweak1
|
||||
MyTweak2
|
||||
!ShowHiddenFiles # Will remove the tweak from selection
|
||||
WaitForKey
|
||||
|
||||
Command using all three examples combined:
|
||||
@@ -209,7 +212,7 @@ Following is a list of rules which I'm trying to apply in this project. The rule
|
||||
Try to give a function a meaningful name up to 25 characters long, which gives away the purpose of the function. Use verbs like `Enable`/`Disable`, `Show`/`Hide`, `Install`/`Uninstall`, `Add`/`Remove` in the beginning of the function name. In case the function doesn't fit any of these verbs, come up with another name, beginning with the verb `Set`, which indicates what the function does, e.g. `SetCurrentNetworkPrivate` and `SetCurrentNetworkPublic`.
|
||||
|
||||
### Revert functions
|
||||
Always add a function with opposite name (or equivalent) which reverts the behavior to default. The default is considered freshly installed Windows 10 or Windows Server 2016 with no adjustments made during or after the installation. If you don't have access to either of these, create the revert function to the best of your knowledge and I will fill in the rest if necessary.
|
||||
Always add a function with opposite name (or equivalent) which reverts the behavior to default. The default is considered freshly installed Windows 10 or Windows Server 2016 / 2019 with no adjustments made during or after the installation. If you don't have access to either of these, create the revert function to the best of your knowledge and I will fill in the rest if necessary.
|
||||
|
||||
### Function similarities
|
||||
Check if there isn't already a function with similar purpose as the one you're trying to add. As long as the name and objective of the existing function is unchanged, feel free to add your tweak to that function rather than creating a new one.
|
||||
@@ -227,7 +230,7 @@ Unless applied on unsupported system, all functions have to be applicable repeat
|
||||
Suppress all output generated by commands and cmdlets using `| Out-Null` or `-ErrorAction SilentlyContinue` where applicable. Whenever an input is needed, use appropriate arguments to suppress the prompt and programmatically provide values for the command to run (e.g. using `-Confirm:$false`). The only acceptable output is from the `Write-Output` cmdlets in the beginning of each function and from non-suppressible cmdlets like `Remove-AppxPackage`.
|
||||
|
||||
### Registry
|
||||
Create the registry keys only if they don't exist on fresh installation if Windows 10 or Windows Server 2016. When deleting registry, delete only registry values, not the whole keys. When you're setting registry values, always use `Set-ItemProperty` instead of `New-ItemProperty`. When you're removing registry values, choose either `Set-ItemProperty` or `Remove-ItemProperty` to reinstate the same situation as it was on the clean installation. Again, if you don't know what the original state was, let me know in PR description and I will fill in the gaps. When you need to use `HKEY_USERS` registry hive, always add following snippet before the registry modification to ensure portability.
|
||||
Create the registry keys only if they don't exist on fresh installation if Windows 10 or Windows Server 2016 / 2019. When deleting registry, delete only registry values, not the whole keys. When you're setting registry values, always use `Set-ItemProperty` instead of `New-ItemProperty`. When you're removing registry values, choose either `Set-ItemProperty` or `Remove-ItemProperty` to reinstate the same situation as it was on the clean installation. Again, if you don't know what the original state was, let me know in PR description and I will fill in the gaps. When you need to use `HKEY_USERS` registry hive, always add following snippet before the registry modification to ensure portability.
|
||||
|
||||
```powershell
|
||||
If (!(Test-Path "HKU:")) {
|
||||
|
||||
18
Win10.ps1
18
Win10.ps1
@@ -1,7 +1,7 @@
|
||||
##########
|
||||
# Win10 / WinServer2016 Initial Setup Script - Main execution loop
|
||||
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Main execution loop
|
||||
# Author: Disassembler <disassembler@dasm.cz>
|
||||
# Version: v3.1, 2018-10-04
|
||||
# Version: v3.3, 2018-10-22
|
||||
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
|
||||
##########
|
||||
|
||||
@@ -16,6 +16,16 @@ Function RequireAdmin {
|
||||
$tweaks = @()
|
||||
$PSCommandArgs = @()
|
||||
|
||||
Function AddOrRemoveTweak($tweak) {
|
||||
If ($tweak[0] -eq "!") {
|
||||
# If the name starts with exclamation mark (!), exclude the tweak from selection
|
||||
$global:tweaks = $global:tweaks | Where-Object { $_ -ne $tweak.Substring(1) }
|
||||
} ElseIf ($tweak -ne "") {
|
||||
# Otherwise add the tweak
|
||||
$global:tweaks += $tweak
|
||||
}
|
||||
}
|
||||
|
||||
# Parse and resolve paths in passed arguments
|
||||
$i = 0
|
||||
While ($i -lt $args.Length) {
|
||||
@@ -30,11 +40,11 @@ While ($i -lt $args.Length) {
|
||||
$preset = Resolve-Path $args[++$i]
|
||||
$PSCommandArgs += "-preset `"$preset`""
|
||||
# Load tweak names from the preset file
|
||||
$tweaks += Get-Content $preset -ErrorAction Stop | ForEach-Object { $_.Split("#")[0].Trim() } | Where-Object { $_ -ne "" }
|
||||
Get-Content $preset -ErrorAction Stop | ForEach-Object { AddOrRemoveTweak($_.Split("#")[0].Trim()) }
|
||||
} Else {
|
||||
$PSCommandArgs += $args[$i]
|
||||
# Load tweak names from command line
|
||||
$tweaks += $args[$i]
|
||||
AddOrRemoveTweak($args[$i])
|
||||
}
|
||||
$i++
|
||||
}
|
||||
|
||||
122
Win10.psm1
122
Win10.psm1
@@ -1,7 +1,7 @@
|
||||
##########
|
||||
# Win10 / WinServer2016 Initial Setup Script - Tweak library
|
||||
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Tweak library
|
||||
# Author: Disassembler <disassembler@dasm.cz>
|
||||
# Version: v3.1, 2018-10-04
|
||||
# Version: v3.3, 2018-10-22
|
||||
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
|
||||
##########
|
||||
|
||||
@@ -128,12 +128,19 @@ Function DisableAppSuggestions {
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338388Enabled" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338389Enabled" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338393Enabled" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353696Enabled" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353698Enabled" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 0
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 1
|
||||
# Empty placeholder tile collection in registry cache and restart Start Menu process to reload the cache
|
||||
If ([System.Environment]::OSVersion.Version.Build -ge 17134) {
|
||||
$key = Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*windows.data.placeholdertilecollection\Current"
|
||||
Set-ItemProperty -Path $key.PSPath -Name "Data" -Type Binary -Value $key.Data[0..15]
|
||||
Stop-Process -Name "ShellExperienceHost" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# Enable Application suggestions and automatic installation
|
||||
@@ -146,6 +153,7 @@ Function EnableAppSuggestions {
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SilentInstalledAppsEnabled" -Type DWord -Value 1
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338388Enabled" -Type DWord -Value 1
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338389Enabled" -Type DWord -Value 1
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353696Enabled" -Type DWord -Value 1
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Type DWord -Value 1
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-310093Enabled" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338387Enabled" -ErrorAction SilentlyContinue
|
||||
@@ -154,20 +162,24 @@ Function EnableAppSuggestions {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Activity History feed in Task View - Note: The checkbox "Let Windows collect my activities from this PC" remains checked even when the function is disabled
|
||||
# Disable Activity History - Applicable since 1709
|
||||
Function DisableActivityHistory {
|
||||
Write-Output "Disabling Activity History..."
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -Type DWord -Value 0
|
||||
Stop-Service "CDPUserSvc" -WarningAction SilentlyContinue
|
||||
Set-Service "CDPUserSvc" -StartupType Disabled
|
||||
}
|
||||
|
||||
# Enable Activity History feed in Task View
|
||||
# Enable Activity History - Applicable since 1709
|
||||
Function EnableActivityHistory {
|
||||
Write-Output "Enabling Activity History..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -ErrorAction SilentlyContinue
|
||||
Set-Service "CDPUserSvc" -StartupType Automatic
|
||||
# CDPUserSvc is a parent for user services and cannot be started directly. The user services will be started after reboot.
|
||||
}
|
||||
|
||||
# Disable Background application access - ie. if apps can download or update when they aren't used - Cortana is excluded as its inclusion breaks start menu search
|
||||
@@ -273,13 +285,13 @@ Function EnableAdvertisingID {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Name "DisabledByGroupPolicy" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable setting "Let websites provide locally relevant content by accessing my language list"
|
||||
# Disable setting 'Let websites provide locally relevant content by accessing my language list'
|
||||
Function DisableWebLangList {
|
||||
Write-Output "Disabling Website Access to Language List..."
|
||||
Set-ItemProperty -Path "HKCU:\Control Panel\International\User Profile" -Name "HttpAcceptLanguageOptOut" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Enable setting "Let websites provide locally relevant content by accessing my language list"
|
||||
# Enable setting 'Let websites provide locally relevant content by accessing my language list'
|
||||
Function EnableWebLangList {
|
||||
Write-Output "Enabling Website Access to Language List..."
|
||||
Remove-ItemProperty -Path "HKCU:\Control Panel\International\User Profile" -Name "HttpAcceptLanguageOptOut" -ErrorAction SilentlyContinue
|
||||
@@ -594,6 +606,33 @@ Function EnableFirewall {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile" -Name "EnableFirewall" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Hide Windows Defender SysTray icon
|
||||
Function HideDefenderTrayIcon {
|
||||
Write-Output "Hiding Windows Defender SysTray icon..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" -Name "HideSystray" -Type DWord -Value 1
|
||||
If ([System.Environment]::OSVersion.Version.Build -eq 14393) {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "WindowsDefender" -ErrorAction SilentlyContinue
|
||||
} ElseIf ([System.Environment]::OSVersion.Version.Build -ge 15063) {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SecurityHealth" -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# Show Windows Defender SysTray icon
|
||||
Function ShowDefenderTrayIcon {
|
||||
Write-Output "Showing Windows Defender SysTray icon..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" -Name "HideSystray" -ErrorAction SilentlyContinue
|
||||
If ([System.Environment]::OSVersion.Version.Build -eq 14393) {
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "WindowsDefender" -Type ExpandString -Value "`"%ProgramFiles%\Windows Defender\MSASCuiL.exe`""
|
||||
} ElseIf ([System.Environment]::OSVersion.Version.Build -ge 15063 -And [System.Environment]::OSVersion.Version.Build -le 17134) {
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SecurityHealth" -Type ExpandString -Value "%ProgramFiles%\Windows Defender\MSASCuiL.exe"
|
||||
} ElseIf ([System.Environment]::OSVersion.Version.Build -ge 17763) {
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SecurityHealth" -Type ExpandString -Value "%windir%\system32\SecurityHealthSystray.exe"
|
||||
}
|
||||
}
|
||||
|
||||
# Disable Windows Defender
|
||||
Function DisableDefender {
|
||||
Write-Output "Disabling Windows Defender..."
|
||||
@@ -665,14 +704,14 @@ Function DisableCIMemoryIntegrity {
|
||||
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" -Name "Enabled" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Enable Windows Defender Application Guard - Applicable since 1709 Enterprise and 1803 Pro
|
||||
# Enable Windows Defender Application Guard - Applicable since 1709 Enterprise and 1803 Pro. Not applicable to Server
|
||||
# Not supported on VMs and VDI environment. Check requirements on https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-guard/reqs-wd-app-guard
|
||||
Function EnableDefenderAppGuard {
|
||||
Write-Output "Enabling Windows Defender Application Guard..."
|
||||
Enable-WindowsOptionalFeature -online -FeatureName "Windows-Defender-ApplicationGuard" -NoRestart -WarningAction SilentlyContinue | Out-Null
|
||||
}
|
||||
|
||||
# Disable Windows Defender Application Guard
|
||||
# Disable Windows Defender Application Guard - Applicable since 1709 Enterprise and 1803 Pro. Not applicable to Server
|
||||
Function DisableDefenderAppGuard {
|
||||
Write-Output "Disabling Windows Defender Application Guard..."
|
||||
Disable-WindowsOptionalFeature -online -FeatureName "Windows-Defender-ApplicationGuard" -NoRestart -WarningAction SilentlyContinue | Out-Null
|
||||
@@ -901,18 +940,20 @@ Function EnableHomeGroups {
|
||||
Start-Service "HomeGroupProvider" -WarningAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Shared Experiences - Not applicable to Server
|
||||
# Disable Shared Experiences - Applicable since 1703. Not applicable to Server
|
||||
# This setting can be set also via GPO, however doing so causes reset of Start Menu cache. See https://github.com/Disassembler0/Win10-Initial-Setup-Script/issues/145 for details
|
||||
Function DisableSharedExperiences {
|
||||
Write-Output "Disabling Shared Experiences..."
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableCdp" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableMmx" -Type DWord -Value 0
|
||||
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CDP")) {
|
||||
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CDP" | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CDP" -Name "RomeSdkChannelUserAuthzPolicy" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable Shared Experiences - Not applicable to Server
|
||||
# Enable Shared Experiences - Applicable since 1703. Not applicable to Server
|
||||
Function EnableSharedExperiences {
|
||||
Write-Output "Enabling Shared Experiences..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableCdp" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableMmx" -ErrorAction SilentlyContinue
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CDP" -Name "RomeSdkChannelUserAuthzPolicy" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Disable Remote Assistance - Not applicable to Server (unless Remote Assistance is explicitly installed)
|
||||
@@ -986,20 +1027,17 @@ Function EnableRestorePoints {
|
||||
Enable-ComputerRestore -Drive "$env:SYSTEMDRIVE"
|
||||
}
|
||||
|
||||
# Enable Storage Sense - automatic disk cleanup - Not applicable to Server
|
||||
# Enable Storage Sense - automatic disk cleanup - Applicable since 1703
|
||||
Function EnableStorageSense {
|
||||
Write-Output "Enabling Storage Sense..."
|
||||
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy")) {
|
||||
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "01" -Type DWord -Value 1
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "04" -Type DWord -Value 1
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "08" -Type DWord -Value 1
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "32" -Type DWord -Value 0
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "StoragePoliciesNotified" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Disable Storage Sense - Not applicable to Server
|
||||
# Disable Storage Sense - Applicable since 1703
|
||||
Function DisableStorageSense {
|
||||
Write-Output "Disabling Storage Sense..."
|
||||
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Recurse -ErrorAction SilentlyContinue
|
||||
@@ -1017,14 +1055,14 @@ Function EnableDefragmentation {
|
||||
Enable-ScheduledTask -TaskName "Microsoft\Windows\Defrag\ScheduledDefrag" | Out-Null
|
||||
}
|
||||
|
||||
# Stop and disable Superfetch service - Not applicable to Server
|
||||
# Stop and disable Superfetch service
|
||||
Function DisableSuperfetch {
|
||||
Write-Output "Stopping and disabling Superfetch service..."
|
||||
Stop-Service "SysMain" -WarningAction SilentlyContinue
|
||||
Set-Service "SysMain" -StartupType Disabled
|
||||
}
|
||||
|
||||
# Start and enable Superfetch service - Not applicable to Server
|
||||
# Start and enable Superfetch service
|
||||
Function EnableSuperfetch {
|
||||
Write-Output "Starting and enabling Superfetch service..."
|
||||
Set-Service "SysMain" -StartupType Automatic
|
||||
@@ -1151,15 +1189,15 @@ Function EnableFastStartup {
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name "HiberbootEnabled" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Disable automatic reboot on crash
|
||||
# Disable automatic reboot on crash (BSOD)
|
||||
Function DisableAutoRebootOnCrash {
|
||||
Write-Output "Disabling automatic reboot on crash..."
|
||||
Write-Output "Disabling automatic reboot on crash (BSOD)..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl" -Name "AutoReboot" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable automatic reboot on crash
|
||||
# Enable automatic reboot on crash (BSOD)
|
||||
Function EnableAutoRebootOnCrash {
|
||||
Write-Output "Enabling automatic reboot on crash..."
|
||||
Write-Output "Enabling automatic reboot on crash (BSOD)..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl" -Name "AutoReboot" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
@@ -1174,9 +1212,9 @@ Function EnableAutoRebootOnCrash {
|
||||
#region UI Tweaks
|
||||
##########
|
||||
|
||||
# Disable Action Center
|
||||
# Disable Action Center (Notification Center)
|
||||
Function DisableActionCenter {
|
||||
Write-Output "Disabling Action Center..."
|
||||
Write-Output "Disabling Action Center (Notification Center)..."
|
||||
If (!(Test-Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer")) {
|
||||
New-Item -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer" | Out-Null
|
||||
}
|
||||
@@ -1184,9 +1222,9 @@ Function DisableActionCenter {
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable Action Center
|
||||
# Enable Action Center (Notification Center)
|
||||
Function EnableActionCenter {
|
||||
Write-Output "Enabling Action Center..."
|
||||
Write-Output "Enabling Action Center (Notification Center)..."
|
||||
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "DisableNotificationCenter" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "ToastEnabled" -ErrorAction SilentlyContinue
|
||||
}
|
||||
@@ -1458,7 +1496,7 @@ Function EnableNewAppPrompt {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoNewAppAlert" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Hide "Recently added" list from Start Menu
|
||||
# Hide 'Recently added' list from Start Menu
|
||||
Function HideRecentlyAddedApps {
|
||||
Write-Output "Hiding 'Recently added' list from Start Menu..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer")) {
|
||||
@@ -1467,7 +1505,7 @@ Function HideRecentlyAddedApps {
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "HideRecentlyAddedApps" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Show "Recently added" list in Start Menu
|
||||
# Show 'Recently added' list in Start Menu
|
||||
Function ShowRecentlyAddedApps {
|
||||
Write-Output "Showing 'Recently added' list in Start Menu..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "HideRecentlyAddedApps" -ErrorAction SilentlyContinue
|
||||
@@ -1542,6 +1580,18 @@ Function SetVisualFXAppearance {
|
||||
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "EnableAeroPeek" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Enable Dark Theme
|
||||
Function EnableDarkTheme {
|
||||
Write-Output "Enabling Dark Theme..."
|
||||
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "AppsUseLightTheme" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Disable Dark Theme
|
||||
Function DisableDarkTheme {
|
||||
Write-Output "Disabling Dark Theme..."
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "AppsUseLightTheme" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Add secondary en-US keyboard
|
||||
Function AddENKeyboard {
|
||||
Write-Output "Adding secondary en-US keyboard..."
|
||||
@@ -2537,7 +2587,8 @@ Function InstallPowerShellV2 {
|
||||
}
|
||||
}
|
||||
|
||||
# Install Linux Subsystem - Applicable since 1607
|
||||
# Install Linux Subsystem - Applicable since Win10 1607 and Server 1709
|
||||
# For automated Linux distribution installation, see https://docs.microsoft.com/en-us/windows/wsl/install-on-server
|
||||
Function InstallLinuxSubsystem {
|
||||
Write-Output "Installing Linux Subsystem..."
|
||||
If ([System.Environment]::OSVersion.Version.Build -eq 14393) {
|
||||
@@ -2548,7 +2599,7 @@ Function InstallLinuxSubsystem {
|
||||
Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -NoRestart -WarningAction SilentlyContinue | Out-Null
|
||||
}
|
||||
|
||||
# Uninstall Linux Subsystem - Applicable since 1607
|
||||
# Uninstall Linux Subsystem - Applicable since Win10 1607 and Server 1709
|
||||
Function UninstallLinuxSubsystem {
|
||||
Write-Output "Uninstalling Linux Subsystem..."
|
||||
If ([System.Environment]::OSVersion.Version.Build -eq 14393) {
|
||||
@@ -2817,9 +2868,10 @@ Function UnpinStartMenuTiles {
|
||||
Set-ItemProperty -Path "$($_.PsPath)\Current" -Name "Data" -Type Binary -Value $data.Split(",")
|
||||
}
|
||||
} ElseIf ([System.Environment]::OSVersion.Version.Build -ge 17134) {
|
||||
$key = Get-ChildItem -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount" -Recurse | Where-Object { $_ -like "*start.tilegrid`$windows.data.curatedtilecollection.tilecollection\Current" }
|
||||
$data = (Get-ItemProperty -Path $key.PSPath -Name "Data").Data[0..25] + ([byte[]](202,50,0,226,44,1,1,0,0))
|
||||
$key = Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*start.tilegrid`$windows.data.curatedtilecollection.tilecollection\Current"
|
||||
$data = $key.Data[0..25] + ([byte[]](202,50,0,226,44,1,1,0,0))
|
||||
Set-ItemProperty -Path $key.PSPath -Name "Data" -Type Binary -Value $data
|
||||
Stop-Process -Name "ShellExperienceHost" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user