-
Notifications
You must be signed in to change notification settings - Fork 1
/
win.ps1
166 lines (150 loc) · 9.98 KB
/
win.ps1
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
function Update-ItemProperty($path, $name, $type, $value) {
if (!(Test-Path $path)) {
New-Item $path -force | Out-Null
}
if ((Get-ItemProperty $path).PSObject.Properties.Name -contains $name) {
Set-ItemProperty $path -Name $name -Value $value | Out-Null
}
else {
New-ItemProperty $path -PropertyType $type -Name $name -Value $value | Out-Null
}
}
### Configure desktop ###
# Don't show Cortana search bar
Update-ItemProperty 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search' 'SearchboxTaskbarMode' 'DWORD' 0
# Show file extensions and hidden files
Update-ItemProperty 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' 'HideFileExt' 'DWORD' 0
Update-ItemProperty 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' 'Hidden' 'DWORD' 1
Update-ItemProperty 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' 'ShowSuperHidden' 'DWORD' 1
# Default desktop icons
$MyComputerDesktopIcon = '{20D04FE0-3AEA-1069-A2D8-08002B30309D}'
$UserDesktopIcon = '{59031a47-3f72-44a7-89c5-5595fe6b30ee}'
$RecycleBinDesktopIcon = '{645FF040-5081-101B-9F08-00AA002F954E}'
$NetworkDesktopIcon = '{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}'
$ControlPanelDesktopIcon = '{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}'
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' $MyComputerDesktopIcon 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' $UserDesktopIcon 'DWORD' 0
# Hide 3D objects in Explorer's sidebar
$3dobj = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}'
$3dObjWow64 = 'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}'
if (Test-Path $3dobj) {
Remove-Item -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}'
}
if (Test-Path $3dObjWow64) {
Remove-Item -Path 'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}'
}
### Updates ###
# Check for updates, but download and install only on demand. Automatic reboot is disabled.
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU' 'AUOptions' 'DWORD' 2
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU' 'NoAutoRebootWithLoggedOnUsers' 'DWORD' 1
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\DeliveryOptimization' 'DODownloadMode' 'DWORD' 0
Update-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config' 'DODownloadMode' 'DWORD' 0
### Privacy ###
# Disable Collect Activity
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\System' 'PublishUserActivities' 'DWORD' 0
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\System' 'UploadUserActivities' 'DWORD' 0
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\System' 'EnableActivityFeed' 'DWORD' 0
# Disable telemetry
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\DataCollection' 'AllowTelemetry' 'DWORD' 0
Set-Service DiagTrack -StartupType Disabled
Stop-Service DiagTrack
# Disable DMW Push service
Set-Service dmwappushservice -StartupType Disabled
Stop-Service dmwappushservice
### Remove built-in bloatware ###
Get-AppxPackage *bubblewitch*| Remove-AppxPackage
Get-AppxPackage *candycrush* | Remove-AppxPackage
Get-AppxPackage *spotify* | Remove-AppxPackage
Get-AppxPackage Microsoft.Office.OneNote | Remove-AppxPackage
Get-AppxPackage Microsoft.OneConnect | Remove-AppxPackage
Get-AppxPackage Microsoft.BingWeather | Remove-AppxPackage
Get-AppxPackage Microsoft.BingNews | Remove-AppxPackage
Get-AppxPackage Microsoft.GetHelp | Remove-AppxPackage
Get-AppxPackage Microsoft.Getstarted | Remove-AppxPackage
Get-AppxPackage Microsoft.MicrosoftOfficeHub | Remove-AppxPackage
Get-AppxPackage Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage
Get-AppxPackage Microsoft.MixedReality.Portal | Remove-AppxPackage
Get-AppxPackage Microsoft.People | Remove-AppxPackage
Get-AppxPackage Microsoft.Wallet | Remove-AppxPackage
Get-AppxPackage Microsoft.Print3D | Remove-AppxPackage
Get-AppxPackage Microsoft.Windows.Photos | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsFeedbackHub | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsMaps | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxApp | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxGameOverlay* | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxGamingOverlay* | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxSpeechToTextOverlay* | Remove-AppxPackage
Get-AppxPackage Microsoft.XboxIdentityProvider | Remove-AppxPackage
Get-AppxPackage Microsoft.Xbox.TCUI | Remove-AppxPackage
Get-AppxPackage Microsoft.YourPhone | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsCamera | Remove-AppxPackage
Get-AppxPackage Microsoft.ZuneMusic | Remove-AppxPackage
Get-AppxPackage Microsoft.ZuneVideo | Remove-AppxPackage
Get-AppxPackage Microsoft.SkypeApp | Remove-AppxPackage
Get-AppxPackage microsoft.windowscommunicationsapps | Remove-AppxPackage
Get-AppxPackage Microsoft.Advertising.Xaml | Remove-AppxPackage
Get-AppxPackage Microsoft.Todos | Remove-AppxPackage
Get-AppxPackage Microsoft.Microsoft3DViewer | Remove-AppxPackage
Get-AppxPackage Microsoft.Messaging | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsAlarms| Remove-AppxPackage
Get-AppxPackage Microsoft.MSPaint | Remove-AppxPackage
Get-AppxPackage Microsoft.MicrosoftStickyNotes | Remove-AppxPackage
# Remove OneDrive #
# Kill onedrive process
$onedrive = Get-Process onedrive -ErrorAction SilentlyContinue
if ($onedrive) {
taskkill.exe /F /IM "OneDrive.exe" | Out-Null
}
# Uninstall OneDrive
if (Test-Path "$env:systemroot\System32\OneDriveSetup.exe") {
& "$env:systemroot\System32\OneDriveSetup.exe" /uninstall
}
if (Test-Path "$env:systemroot\SysWOW64\OneDriveSetup.exe") {
& "$env:systemroot\SysWOW64\OneDriveSetup.exe" /uninstall
}
# Disable OneDrive via Group Policies
Update-ItemProperty 'HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive' 'DisableFileSyncNGSC' 'DWORD' 1
# Remove OneDrive leftover directories
rm -Recurse -Force -ErrorAction SilentlyContinue "$env:localappdata\Microsoft\OneDrive"
rm -Recurse -Force -ErrorAction SilentlyContinue "$env:programdata\Microsoft OneDrive"
rm -Recurse -Force -ErrorAction SilentlyContinue "C:\OneDriveTemp"
# Remove startmenu entry
rm -Force -ErrorAction SilentlyContinue "$env:userprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk"
# Remove OneDrive directory from user home
rm -Recurse -Force -ErrorAction SilentlyContinue "$env:userprofile\OneDrive"
### Disable bloatware installing and advertising
# Don't silently install more bloatware
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'ContentDeliveryAllowed' 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'OemPreInstalledAppsEnabled' 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'PreInstalledAppsEnabled' 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'PreInstalledAppsEverEnabled' 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SilentInstalledAppsEnabled' 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SystemPaneSuggestionsEnabled' 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-338388Enabled' 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SubscribedContent-338389Enabled' 'DWORD' 0
# for new users
Update-ItemProperty 'Registry::HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SystemPaneSuggestionsEnabled' 'DWORD' 0
Update-ItemProperty 'Registry::HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'PreInstalledAppsEnabled' 'DWORD' 0
Update-ItemProperty 'Registry::HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'OemPreInstalledAppsEnabled' 'DWORD' 0
# Disable tips
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' 'SoftLandingEnabled' 'DWORD' 0
# Disable Consumer experience to prevent "Suggested Applications" returning
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\CloudContent' 'DisableWindowsConsumerFeatures' 'DWORD' 1
### Privacy
## Disable Cortana
# Prevents sending speech, inking and typing samples to MS
Update-ItemProperty 'HKCU:\Software\Microsoft\Personalization\Settings' 'AcceptedPrivacyPolicy' 'DWORD' 0
# Prevents sending contacts to MS
Update-ItemProperty 'HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore' 'HarvestContacts' 'DWORD' 0
# Disable Cortana, web search and stop service
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\Windows Search' 'AllowCortana' 'DWORD' 0
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\Windows Search' 'ConnectedSearchUseWeb' 'DWORD' 0
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\Windows Search' 'ConnectedSearchUseWebOverMeteredConnections' 'DWORD' 0
Update-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\Windows Search' 'DisableWebSearch' 'DWORD' 1
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search' 'AllowSearchToUseLocation' 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search' 'BingSearchEnabled' 'DWORD' 0
Update-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search' 'CortanaConsent' 'DWORD' 0
Set-Service WSearch -StartupType Disabled
Stop-Service WSearch
# Handwriting recognition personalization
Update-ItemProperty 'HKCU:\Software\Microsoft\InputPersonalization' 'RestrictImplicitInkCollection' 'DWORD' 1