-
Notifications
You must be signed in to change notification settings - Fork 2
/
Settings_Privacy.ps1
268 lines (220 loc) · 12.9 KB
/
Settings_Privacy.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
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
############################################################
# (c) Daniel Petrescu
############################################################
# The software is provided "as is", without warranty of any kind, express or implied, including but
# not limited to the warranty of fitness for a particular purpose. In no event shall the authors or
# copyright holders be liable for any claim, damages or other liability, whether in an action of
# contract or otherwise, arising from, out of, or in connection with the software or the use or
# other dealings in the software.
############################################################
### Get variables
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptpath
Push-Location $scriptDir
. '.\Variables.ps1'
############################################################
#region Script Init
### Copy the output to a log file
$ScriptName = ([io.fileinfo]$MyInvocation.MyCommand.Name).basename
$OutputFileLocation = "$($PSScriptRoot)\logs\$($ScriptName)_output_$($TheDateOutput).txt"
''
Start-Transcript -path $OutputFileLocation -append
''
### Print headers
$scriptLogo = @"
___ ____ _ _ _ ____ ____ _ _
|__] |__/ | | | |__| | \_/
| | \ | \/ | | |___ |
"@
Print-Headers "$scriptLogo"
#endregion
##############################
#region Start Script
Write-Host "`r`n===== START =====" -ForegroundColor "Black" -BackgroundColor "yellow"
### Make sure the Execution Policy is 'Unrestricted'
$currentExecutionPolicy = Get-ExecutionPolicy
$resetExecutionPolicy = 0
Write-Host "`r`n$myOSstring"
Write-Host "`r`nThe current Execution Policy is: $currentExecutionPolicy" -ForegroundColor "Gray"
if ($currentExecutionPolicy -ne "Unrestricted") {
$resetExecutionPolicy = 1
Write-Host 'Setting Execution Policy to: Unrestricted. This will be changed back at the end of the script.' -ForegroundColor "Gray"
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
}
#endregion
############################################################
#region Settings: Privacy
Write-Host "`r`n`r`nCHANGING PRIVACY SETTINGS" -ForegroundColor "Green"
' Privacy -> General -> Let apps use my advertising id for experiences across apps (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo\' `
-Name 'Enabled' `
-Value 0 `
-Type 'DWord'
' Privacy -> General -> SmartScreen Filter to check web content that Windows Store apps use (on)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost\' `
-Name 'EnableWebContentEvaluation' `
-Value 1 `
-Type 'DWord'
' Privacy -> General -> Send Microsoft info about how I write to help us improve typing and writing in the future (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Input\TIPC\' `
-Name 'Enabled' `
-Value 0
' Privacy -> General -> Let websites provide locally relevant content by accessing my language list (off)'
if ((Get-ItemProperty -Path 'HKCU:SOFTWARE\Microsoft\Internet Explorer\International\' -Name 'AcceptLanguage' -ErrorAction SilentlyContinue) -ne $null) {
Remove-ItemProperty -Path 'HKCU:SOFTWARE\Microsoft\Internet Explorer\International\' -Name 'AcceptLanguage' -Force
}
Set-RegistryValue -Path 'HKCU:Control Panel\International\User Profile\' `
-Name 'HttpAcceptLanguageOptOut' `
-Value 1
If ($myOS.BuildNumber -ge 14393) { # Apply only for version 1607 (Redstone 1) or newer
' Privacy -> General -> Let apps on my other devices open apps and continue experiences on this device (off)'
Set-RegistryValue -Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\SmartGlass\' `
-Name 'UserAuthPolicy' `
-Value 0
}
If ($myOS.BuildNumber -ge 14393) { # Apply only for version 1607 (Redstone 1) or newer
' Privacy -> General -> Let apps on my other devices use Bluetooth to open apps and continue experiences on this device (off)'
Set-RegistryValue -Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\SmartGlass\' `
-Name 'BluetoothPolicy' `
-Value 0
}
' Privacy -> Location -> Location (for this account) (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}\' `
-Name 'Value' `
-Value 'Deny'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{E6AD100E-5F4E-44CD-BE0F-2265D88D14F5\' `
-Name 'Value' `
-Value 'Deny'
Set-RegistryValue -Path 'HKCU:SSOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Permissions\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}\' `
-Name 'SensorPermissionState ' `
-Value 0 `
-Type 'DWord'
<#' Privacy -> Location -> Location for this device (for all accounts) (off) [automatically resets]'
Set-RegistryValue -Path 'HKLM:Software\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}\' `
-Name 'SensorPermissionState' `
-Value 0 `
-Type 'DWord'#>
' Privacy -> Camera -> Let apps use my camera (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{E5323777-F976-4f5b-9B55-B94699C46E44}\' `
-Name 'Value' `
-Value 'Deny'
' Privacy -> Microphone -> Let apps use my microphone (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{2EEF81BE-33FA-4800-9670-1CD474972C3F}\' `
-Name 'Value' `
-Value 'Deny'
If ($myOS.BuildNumber -ge 14393) { # Apply only for version 1607 (Redstone 1) or newer
' Privacy -> Notifications -> Let apps access my notifications (off)'
Write-Host ' └-> NOTE: This setting might reset to the default (on). If so, change it manually.' -ForegroundColor "Yellow"
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{52079E78-A92B-413F-B213-E8FE35712E72}\' `
-Name 'Value' `
-Value 'Deny'
}
If ($myOS.BuildNumber -ge 10586) { # Apply only for version 1511 (Threshold 2) or newer
' Privacy -> Speech, inking & typing -> Disable Cortana'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Search\' `
-Name 'CortanaEnabled' `
-Value 0 `
-Type 'DWord'
}
' Privacy -> Speech, inking & typing -> Get to know my typing (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Personalization\Settings\' `
-Name 'AcceptedPrivacyPolicy' `
-Value 0 `
-Type 'DWord'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language\' `
-Name 'Enabled' `
-Value 0 `
-Type 'DWord'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\InputPersonalization\' `
-Name 'RestrictImplicitTextCollection' `
-Value 1 `
-Type 'DWord'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\InputPersonalization\' `
-Name 'RestrictImplicitInkCollection' `
-Value 1 `
-Type 'DWord'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore\' `
-Name 'HarvestContacts' `
-Value 0 `
-Type 'DWord'
' Privacy -> Account info -> Let apps access my name, picture and other account info (off)'
Write-Host ' └-> NOTE: This setting might reset to the default (on). If so, change it manually.' -ForegroundColor "Yellow"
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{C1D23ACC-752B-43E5-8448-8D0E519CD6D6}\' `
-Name 'Value' `
-Value 'Deny'
' Privacy -> Contacts -> Let apps access my contacts (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{7D7E8402-7C54-4821-A34E-AEEFD62DED93}\' `
-Name 'Value' `
-Value 'Deny'
' Privacy -> Calendar -> Let apps access my calendar (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{D89823BA-7180-4B81-B50C-7E471E6121A3}\' `
-Name 'Value' `
-Value 'Deny'
If ($myOS.BuildNumber -ge 10586) { # Apply only for version 1511 (Threshold 2) or newer
' Privacy -> Call history -> Let apps access my call history (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{8BC668CF-7728-45BD-93F8-CF2B3B41D7AB}\' `
-Name 'Value' `
-Value 'Deny'
}
If ($myOS.BuildNumber -ge 10586) { # Apply only for version 1511 (Threshold 2) or newer
' Privacy -> Email -> Let apps access and send email (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{9231CB4C-BF57-4AF3-8C55-FDA7BFCC04C5}\' `
-Name 'Value' `
-Value 'Deny'
}
' Privacy -> Messaging -> Let apps read or send text/SMS/MMS messages (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{992AFA70-6F47-4148-B3E9-3003349C1548}\' `
-Name 'Value' `
-Value 'Deny'
' Privacy -> Radios -> Let apps control radios (off)'
Write-Host ' └-> NOTE: This setting might reset to the default (on). If so, change it manually.' -ForegroundColor "Yellow"
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\{A8804298-2D5F-42E3-9531-9C8C39EB29CE}\' `
-Name 'Value' `
-Value 'Deny'
' Privacy -> Other devices -> Sync with devices (off)'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\DeviceAccess\Global\LooselyCoupled\' `
-Name 'Value' `
-Value 'Deny'
' Privacy -> Feedback & diagnostics -> Windows should ask for my feedback: "Never"'
Set-RegistryValue -Path 'HKCU:SOFTWARE\Microsoft\Siuf\Rules\' `
-Name 'NumberOfSIUFInPeriod' `
-Value 0 `
-Type 'DWord'
' Privacy -> Feedback & diagnostics -> Send your device data to Microsoft: "Security"'
If ($myOS.BuildNumber -lt 14393) { # Apply only for version 1511 (Threshold 2) or older
Write-Host ' └-> NOTE: "Update & Security -> Windows Update -> Advanced options -> Get Insider Builds" will be disabled. To enable, set this to "Enhanced".' -ForegroundColor "Yellow"
} else {
Write-Host ' └-> NOTE: "Update & Security -> Windows Insider Program -> Get started" will be disabled. To enable, set this to "Enhanced".' -ForegroundColor "Yellow"
}
<#Set-RegistryValue -Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection\' `
-Name 'AllowTelemetry' `
-Value 0 `
-Type 'DWord'#>
Set-RegistryValue -Path 'HKLM:SOFTWARE\Policies\Microsoft\Windows\DataCollection\' `
-Name 'AllowTelemetry' `
-Value 0 `
-Type 'DWord'
<#Set-RegistryValue -Path 'HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection\' `
-Name 'AllowTelemetry' `
-Value 0 `
-Type 'DWord'#>
<# OPTIONS:
0 = "Security" [not available in UI]
1 = "Basic" - OS version, functioning of Windows, device capabilities
2 = "Enhanced" - Basic + how you use Windows, which feature you use the most, the most frequently used apps by the users, diagnostic information
3 = "Full (recommended)" - Enhanced + system files, memory snapshots, part of the document you were working on when the app crashed, etc.
#>
If ($myOS.Caption -notlike '*Home') { # This does not work on Home editions
' Privacy -> Turn off Microsoft consumer experience'
' └-> Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Cloud Content'
Set-RegistryValue -Path 'HKLM:SOFTWARE\Policies\Microsoft\Windows\CloudContent\' `
-Name 'DisableWindowsConsumerFeatures' `
-Value 1 `
-Type 'DWord'
}
#endregion
############################################################
Write-Host ""
Reset-Execution-Policy
Stop-Transcript
Pop-Location