9 Commits
3.2 ... 3.3

Author SHA1 Message Date
Disassembler
f830a46fa9 v3.3, 2018-10-22, Tweak exclusion support added
- Add option to remove tweaks from selection (see advanced usage)
 - Add "Enable Dark Theme" (thx @DaniloNC)
 - Update DisableActivityHistory to disable CDP user service
 - Minor description updates in comments
2018-10-22 17:38:55 +02:00
Milos Svasek
544e15aefc Fixing ShowDefenderTrayIcon function name (#157) 2018-10-22 14:18:29 +02:00
r3incarnat0r
436e708a1f Unified quotes (#155) 2018-10-18 05:26:20 +02:00
Conder000
e4a24bf83d Update description for DisableAutoRebootOnCrash and DisableActionCenter (#154) 2018-10-14 07:44:32 +02:00
Disassembler
771a32db0d Update PayPal link 2018-10-12 19:43:03 +02:00
Disassembler
5ccc376764 Add option to remove tweaks from selection, closes #152
also kinda related to #81 and #99
2018-10-12 18:57:15 +02:00
Disassembler
ef8b490da8 Simplify registry operations in DisableAppSuggestions and UnpinStartMenuTiles, related to #148 2018-10-11 07:11:18 +02:00
Disassembler
08ce664a37 Update DisableActivityHistory to disable CDP user service, closes #149 2018-10-10 15:48:32 +02:00
Disassembler
c511b60739 Add "Enable Dark Theme", closes #150 (thx @DaniloNC) 2018-10-10 08:25:36 +02:00
4 changed files with 59 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
##########
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Default preset
# Author: Disassembler <disassembler@dasm.cz>
# Version: v3.2, 2018-10-08
# Version: v3.3, 2018-10-22
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
##########
@@ -103,6 +103,7 @@ DisableNewAppPrompt # EnableNewAppPrompt
# SetControlPanelSmallIcons # SetControlPanelLargeIcons # SetControlPanelCategories
DisableShortcutInName # EnableShortcutInName
SetVisualFXPerformance # SetVisualFXAppearance
# EnableDarkTheme # DisableDarkTheme
# AddENKeyboard # RemoveENKeyboard
# EnableNumlock # DisableNumlock
# SetSoundSchemeNone # SetSoundSchemeDefault

View File

@@ -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.
&nbsp;
@@ -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:

View File

@@ -1,7 +1,7 @@
##########
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Main execution loop
# Author: Disassembler <disassembler@dasm.cz>
# Version: v3.2, 2018-10-08
# 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++
}

View File

@@ -1,7 +1,7 @@
##########
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Tweak library
# Author: Disassembler <disassembler@dasm.cz>
# Version: v3.2, 2018-10-08
# Version: v3.3, 2018-10-22
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
##########
@@ -137,9 +137,8 @@ Function DisableAppSuggestions {
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-ChildItem -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount" -Recurse | Where-Object { $_ -like "*windows.data.placeholdertilecollection\Current" }
$data = (Get-ItemProperty -Path $key.PSPath -Name "Data").Data[0..15]
Set-ItemProperty -Path $key.PSPath -Name "Data" -Type Binary -Value $data
$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
}
}
@@ -163,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
@@ -282,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
@@ -618,7 +621,7 @@ Function HideDefenderTrayIcon {
}
# Show Windows Defender SysTray icon
Function HideDefenderTrayIcon {
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) {
@@ -1186,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
}
@@ -1209,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
}
@@ -1219,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
}
@@ -1493,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")) {
@@ -1502,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
@@ -1577,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..."
@@ -2853,8 +2868,8 @@ 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
}