forked from Disassembler0/Win10-Initial-Setup-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWin10.ps1
More file actions
216 lines (194 loc) · 9.53 KB
/
Win10.ps1
File metadata and controls
216 lines (194 loc) · 9.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
##########
# Win10 / WinServer2016 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: development
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
##########
# Push the current location and change to the location this script is running from.
Push-Location -Path $PSScriptRoot
# Create the complete path to the root
$RootPath = (Get-Item -Path "$PSScriptRoot\.." -Verbose).FullName
Import-Module -Name "$RootPath\Win10Settings.psm1"
# Default preset
$tweaks = @(
### Require administrator privileges ###
"RequireAdmin",
### Privacy Tweaks ###
"DisableTelemetry", # "EnableTelemetry",
"DisableWiFiSense", # "EnableWiFiSense",
# "DisableSmartScreen", # "EnableSmartScreen",
"DisableWebSearch", # "EnableWebSearch",
"DisableAppSuggestions", # "EnableAppSuggestions",
"DisableActivityHistory", # "EnableActivityHistory",
"DisableBackgroundApps", # "EnableBackgroundApps",
"DisableLocationTracking", # "EnableLocationTracking",
"DisableMapUpdates", # "EnableMapUpdates",
"DisableFeedback", # "EnableFeedback",
"DisableTailoredExperiences", # "EnableTailoredExperiences",
"DisableAdvertisingID", # "EnableAdvertisingID",
"DisableWebLangList", # "EnableWebLangList",
"DisableCortana", # "EnableCortana",
"DisableErrorReporting", # "EnableErrorReporting",
# "SetP2PUpdateLocal", # "SetP2PUpdateInternet",
"DisableDiagTrack", # "EnableDiagTrack",
"DisableWAPPush", # "EnableWAPPush",
### Security Tweaks ###
# "SetUACLow", # "SetUACHigh",
# "EnableSharingMappedDrives", # "DisableSharingMappedDrives",
"DisableAdminShares", # "EnableAdminShares",
# "DisableSMB1", # "EnableSMB1",
# "DisableSMBServer", # "EnableSMBServer",
# "DisableLLMNR", # "EnableLLMNR",
"SetCurrentNetworkPrivate", # "SetCurrentNetworkPublic",
# "SetUnknownNetworksPrivate", # "SetUnknownNetworksPublic",
# "DisableNetDevicesAutoInst", # "EnableNetDevicesAutoInst",
# "EnableCtrldFolderAccess", # "DisableCtrldFolderAccess",
# "DisableFirewall", # "EnableFirewall",
# "DisableDefender", # "EnableDefender",
# "DisableDefenderCloud", # "EnableDefenderCloud",
"EnableF8BootMenu", # "DisableF8BootMenu",
"SetDEPOptOut", # "SetDEPOptIn",
# "EnableCIMemoryIntegrity", # "DisableCIMemoryIntegrity",
"DisableScriptHost", # "EnableScriptHost",
"EnableDotNetStrongCrypto", # "DisableDotNetStrongCrypto",
# "EnableMeltdownCompatFlag" # "DisableMeltdownCompatFlag",
### Service Tweaks ###
# "DisableUpdateMSRT", # "EnableUpdateMSRT",
# "DisableUpdateDriver", # "EnableUpdateDriver",
"DisableUpdateRestart", # "EnableUpdateRestart",
# "DisableHomeGroups", # "EnableHomeGroups",
"DisableSharedExperiences", # "EnableSharedExperiences",
"DisableRemoteAssistance", # "EnableRemoteAssistance",
"EnableRemoteDesktop", # "DisableRemoteDesktop",
"DisableAutoplay", # "EnableAutoplay",
"DisableAutorun", # "EnableAutorun",
# "EnableStorageSense", # "DisableStorageSense",
# "DisableDefragmentation", # "EnableDefragmentation",
# "DisableSuperfetch", # "EnableSuperfetch",
# "DisableIndexing", # "EnableIndexing",
# "SetBIOSTimeUTC", # "SetBIOSTimeLocal",
# "EnableHibernation", # "DisableHibernation",
# "DisableSleepButton", # "EnableSleepButton",
# "DisableSleepTimeout", # "EnableSleepTimeout",
# "DisableFastStartup", # "EnableFastStartup",
### UI Tweaks ###
"DisableActionCenter", # "EnableActionCenter",
"HideAccountProtectionWarn", # "ShowAccountProtectionWarn",
"DisableLockScreen", # "EnableLockScreen",
# "DisableLockScreenRS1", # "EnableLockScreenRS1",
"HideNetworkFromLockScreen", # "ShowNetworkOnLockScreen",
"HideShutdownFromLockScreen", # "ShowShutdownOnLockScreen",
"DisableStickyKeys", # "EnableStickyKeys",
"ShowTaskManagerDetails" # "HideTaskManagerDetails",
"ShowFileOperationsDetails", # "HideFileOperationsDetails",
# "EnableFileDeleteConfirm", # "DisableFileDeleteConfirm",
"HideTaskbarSearch", # "ShowTaskbarSearchIcon", # "ShowTaskbarSearchBox",
"HideTaskView", # "ShowTaskView",
"ShowSmallTaskbarIcons", # "ShowLargeTaskbarIcons",
"SetTaskbarCombineWhenFull", # "SetTaskbarCombineNever", # "SetTaskbarCombineAlways",
"HideTaskbarPeopleIcon", # "ShowTaskbarPeopleIcon",
"ShowTrayIcons", # "HideTrayIcons",
"DisableSearchAppInStore", # "EnableSearchAppInStore",
"DisableNewAppPrompt", # "EnableNewAppPrompt",
# "SetControlPanelSmallIcons", # "SetControlPanelLargeIcons", # "SetControlPanelCategories",
"SetVisualFXPerformance", # "SetVisualFXAppearance",
# "AddENKeyboard", # "RemoveENKeyboard",
# "EnableNumlock", # "DisableNumlock",
### Explorer UI Tweaks ###
"ShowKnownExtensions", # "HideKnownExtensions",
"ShowHiddenFiles", # "HideHiddenFiles",
# "HideSelectCheckboxes", # "ShowSelectCheckboxes",
"HideSyncNotifications" # "ShowSyncNotifications",
"HideRecentShortcuts", # "ShowRecentShortcuts",
"SetExplorerThisPC", # "SetExplorerQuickAccess",
"ShowThisPCOnDesktop", # "HideThisPCFromDesktop",
# "ShowUserFolderOnDesktop", # "HideUserFolderFromDesktop",
"HideDesktopFromThisPC", # "ShowDesktopInThisPC",
# "HideDesktopFromExplorer", # "ShowDesktopInExplorer",
"HideDocumentsFromThisPC", # "ShowDocumentsInThisPC",
# "HideDocumentsFromExplorer", # "ShowDocumentsInExplorer",
"HideDownloadsFromThisPC", # "ShowDownloadsInThisPC",
# "HideDownloadsFromExplorer", # "ShowDownloadsInExplorer",
"HideMusicFromThisPC", # "ShowMusicInThisPC",
# "HideMusicFromExplorer", # "ShowMusicInExplorer",
"HidePicturesFromThisPC", # "ShowPicturesInThisPC",
# "HidePicturesFromExplorer", # "ShowPicturesInExplorer",
"HideVideosFromThisPC", # "ShowVideosInThisPC",
# "HideVideosFromExplorer", # "ShowVideosInExplorer",
"Hide3DObjectsFromThisPC", # "Show3DObjectsInThisPC",
# "Hide3DObjectsFromExplorer", # "Show3DObjectsInExplorer",
# "DisableThumbnails", # "EnableThumbnails",
"DisableThumbnailCache", # "EnableThumbnailCache",
"DisableThumbsDBOnNetwork", # "EnableThumbsDBOnNetwork",
### Application Tweaks ###
"DisableOneDrive", # "EnableOneDrive",
"UninstallOneDrive", # "InstallOneDrive",
"UninstallMsftBloat", # "InstallMsftBloat",
"UninstallThirdPartyBloat", # "InstallThirdPartyBloat",
# "UninstallWindowsStore", # "InstallWindowsStore",
"DisableXboxFeatures", # "EnableXboxFeatures",
"DisableAdobeFlash", # "EnableAdobeFlash",
"DisableEdgeShortcutCreation", # "EnableEdgeShortcutCreation",
# "UninstallMediaPlayer", # "InstallMediaPlayer",
# "UninstallInternetExplorer", # "InstallInternetExplorer",
# "UninstallWorkFolders", # "InstallWorkFolders",
# "InstallLinuxSubsystem", # "UninstallLinuxSubsystem",
# "InstallHyperV", # "UninstallHyperV",
"SetPhotoViewerAssociation", # "UnsetPhotoViewerAssociation",
"AddPhotoViewerOpenWith", # "RemovePhotoViewerOpenWith",
# "UninstallPDFPrinter", # "InstallPDFPrinter",
"UninstallXPSPrinter", # "InstallXPSPrinter",
"RemoveFaxPrinter", # "AddFaxPrinter",
### Server Specific Tweaks ###
# "HideServerManagerOnLogin", # "ShowServerManagerOnLogin",
# "DisableShutdownTracker", # "EnableShutdownTracker",
# "DisablePasswordPolicy", # "EnablePasswordPolicy",
# "DisableCtrlAltDelLogin", # "EnableCtrlAltDelLogin",
# "DisableIEEnhancedSecurity", # "EnableIEEnhancedSecurity",
# "EnableAudio", # "DisableAudio",
### Unpinning ###
# "UnpinStartMenuTiles",
# "UnpinTaskbarIcons",
### Auxiliary Functions ###
"WaitForKey",
"Restart"
)
##########
# Auxiliary Functions
##########
# Relaunch the script with administrator privileges
Function RequireAdmin {
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`" $PSCommandArgs" -WorkingDirectory $pwd -Verb RunAs
Exit
}
}
# Wait for key press
Function WaitForKey {
Write-Output "`nPress any key to continue..."
[Console]::ReadKey($true) | Out-Null
}
# Restart computer
Function Restart {
Write-Output "Restarting..."
Restart-Computer
}
##########
# Parse parameters and apply tweaks
##########
# Normalize path to preset file
$preset = ""
$PSCommandArgs = $args
If ($args -And $args[0].ToLower() -eq "-preset") {
$preset = Resolve-Path $($args | Select-Object -Skip 1)
$PSCommandArgs = "-preset `"$preset`""
}
# Load function names from command line arguments or a preset file
If ($args) {
$tweaks = $args
If ($preset) {
$tweaks = Get-Content $preset -ErrorAction Stop | ForEach { $_.Trim() } | Where { $_ -ne "" -and $_[0] -ne "#" }
}
}
# Call the desired tweak functions
$tweaks | ForEach { Invoke-Expression $_ }