forked from LeDragoX/Win-Debloat-Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndividual-Tweaks.psm1
404 lines (340 loc) · 24.2 KB
/
Individual-Tweaks.psm1
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Get-HardwareInfo.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Grant-RegistryPermission.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Manage-Software.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\New-Shortcut.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\Title-Templates.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Remove-ItemVerified.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-CapabilityState.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-ItemPropertyVerified.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-OptionalFeatureState.psm1"
Import-Module -DisableNameChecking "$PSScriptRoot\..\lib\debloat-helper\Set-ServiceStartup.psm1"
$DesktopPath = [Environment]::GetFolderPath("Desktop");
$PathToLMPoliciesCloudContent = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
$PathToLMPoliciesAppGameDVR = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR"
$PathToLMPoliciesCortana = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
$PathToLMPoliciesGameDVR = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR"
$PathToLMPoliciesSystem = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System"
$PathToLMPoliciesWindowsUpdate = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
$PathToCUClipboard = "HKCU:\Software\Microsoft\Clipboard"
$PathToCUOnlineSpeech = "HKCU:\SOFTWARE\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy"
$PathToCUThemes = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
$PathToCUXboxGameBar = "HKCU:\Software\Microsoft\GameBar"
function Disable-ActivityHistory() {
Write-Status -Types "-", "Privacy" -Status "Disabling Activity History..."
Set-ItemPropertyVerified -Path $PathToLMPoliciesSystem -Name "EnableActivityFeed" -Type DWord -Value 0
Set-ItemPropertyVerified -Path $PathToLMPoliciesSystem -Name "PublishUserActivities" -Type DWord -Value 0
Set-ItemPropertyVerified -Path $PathToLMPoliciesSystem -Name "UploadUserActivities" -Type DWord -Value 0
}
function Enable-ActivityHistory() {
Write-Status -Types "*", "Privacy" -Status "Enabling Activity History..."
Remove-ItemProperty -Path $PathToLMPoliciesSystem -Name "EnableActivityFeed"
Remove-ItemProperty -Path $PathToLMPoliciesSystem -Name "PublishUserActivities"
Remove-ItemProperty -Path $PathToLMPoliciesSystem -Name "UploadUserActivities"
}
function Disable-AutomaticWindowsUpdate() {
Write-Status -Types "-", "WU" -Status "Disabling Automatic Download and Installation of Windows Updates..."
# [@] (2 = Notify before download, 3 = Automatically download and notify of installation)
# [@] (4 = Automatically download and schedule installation, 5 = Automatic Updates is required and users can configure it)
Set-ItemPropertyVerified -Path "$PathToLMPoliciesWindowsUpdate" -Name "AUOptions" -Type DWord -Value 2
}
function Enable-AutomaticWindowsUpdate() {
Write-Status -Types "*", "WU" -Status "Enabling Automatic Download and Installation of Windows Updates..."
Set-ItemPropertyVerified -Path "$PathToLMPoliciesWindowsUpdate" -Name "AUOptions" -Type DWord -Value 5
}
function Disable-BackgroundAppsToogle() {
Write-Status -Types "-", "Misc" -Status "Disabling Background Apps..."
Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" -Name "GlobalUserDisabled" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BackgroundAppGlobalToggle" -Type DWord -Value 0
}
function Enable-BackgroundAppsToogle() {
Write-Status -Types "*", "Misc" -Status "Enabling Background Apps..."
Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" -Name "GlobalUserDisabled" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" -Name "BackgroundAppGlobalToggle" -Type DWord -Value 1
}
function Disable-ClipboardHistory() {
Write-Status -Types "-", "Privacy" -Status "Disabling Clipboard History (requires reboot!)..."
Remove-ItemProperty -Path "$PathToLMPoliciesSystem" -Name "AllowClipboardHistory"
Remove-ItemProperty -Path "$PathToCUClipboard" -Name "EnableClipboardHistory"
}
function Enable-ClipboardHistory() {
Write-Status -Types "*", "Privacy" -Status "Enabling Clipboard History (requires reboot!)..."
Set-ItemPropertyVerified -Path "$PathToLMPoliciesSystem" -Name "AllowClipboardHistory" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUClipboard" -Name "EnableClipboardHistory" -Type DWord -Value 1
}
function Disable-ClipboardSyncAcrossDevice() {
Write-Status -Types "-", "Privacy" -Status "Disabling Clipboard across devices (must be using MS account)..."
Set-ItemPropertyVerified -Path "$PathToLMPoliciesSystem" -Name "AllowCrossDeviceClipboard" -Type DWord -Value 0
If ((Get-Item "$PathToCUClipboard").Property -contains "CloudClipboardAutomaticUpload") {
Remove-ItemProperty -Path "$PathToCUClipboard" -Name "CloudClipboardAutomaticUpload"
}
If ((Get-Item "$PathToCUClipboard").Property -contains "EnableCloudClipboard") {
Remove-ItemProperty -Path "$PathToCUClipboard" -Name "EnableCloudClipboard"
}
}
function Enable-ClipboardSyncAcrossDevice() {
Write-Status -Types "*", "Privacy" -Status "Enabling Clipboard across devices (must be using MS account)..."
Set-ItemPropertyVerified -Path "$PathToLMPoliciesSystem" -Name "AllowCrossDeviceClipboard" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUClipboard" -Name "CloudClipboardAutomaticUpload" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUClipboard" -Name "EnableCloudClipboard " -Type DWord -Value 1
}
function Disable-Cortana() {
Write-Status -Types "-", "Privacy" -Status "Disabling Cortana..."
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCortana" -Name "AllowCortana" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCortana" -Name "AllowCloudSearch" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCortana" -Name "ConnectedSearchUseWeb" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCortana" -Name "DisableWebSearch" -Type DWord -Value 1
}
function Enable-Cortana() {
Write-Status -Types "*", "Privacy" -Status "Enabling Cortana..."
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCortana" -Name "AllowCortana" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCortana" -Name "AllowCloudSearch" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCortana" -Name "ConnectedSearchUseWeb" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCortana" -Name "DisableWebSearch" -Type DWord -Value 0
}
function Disable-DarkTheme() {
Write-Status -Types "*", "Personal" -Status "Disabling Dark Theme..."
Set-ItemPropertyVerified -Path "$PathToCUThemes" -Name "AppsUseLightTheme" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToCUThemes" -Name "SystemUsesLightTheme" -Type DWord -Value 1
}
function Enable-DarkTheme() {
Write-Status -Types "+", "Personal" -Status "Enabling Dark Theme..."
Set-ItemPropertyVerified -Path "$PathToCUThemes" -Name "AppsUseLightTheme" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToCUThemes" -Name "SystemUsesLightTheme" -Type DWord -Value 0
}
function Disable-EncryptedDNS() {
# I'm still not sure how to disable DNS over HTTPS, so this'll need to wait
# Adapted from: https://stackoverflow.com/questions/64465089/powershell-cmdlet-to-remove-a-statically-configured-dns-addresses-from-a-network
Write-Status -Types "*" -Status "Resetting DNS server configs..."
Set-DnsClientServerAddress -InterfaceAlias "Ethernet*" -ResetServerAddresses
Set-DnsClientServerAddress -InterfaceAlias "Wi-Fi*" -ResetServerAddresses
}
function Enable-EncryptedDNS() {
# Adapted from: https://techcommunity.microsoft.com/t5/networking-blog/windows-insiders-gain-new-dns-over-https-controls/ba-p/2494644
Write-Status -Types "+" -Status "Setting up the DNS over HTTPS for Google and Cloudflare (ipv4 and ipv6)..."
Set-DnsClientDohServerAddress -ServerAddress ("8.8.8.8", "8.8.4.4", "2001:4860:4860::8888", "2001:4860:4860::8844") -AutoUpgrade $true -AllowFallbackToUdp $true
Set-DnsClientDohServerAddress -ServerAddress ("1.1.1.1", "1.0.0.1", "2606:4700:4700::1111", "2606:4700:4700::1001") -AutoUpgrade $true -AllowFallbackToUdp $true
Write-Status -Types "+" -Status "Setting up the DNS from Cloudflare and Google (ipv4 and ipv6)..."
#Get-DnsClientServerAddress # To look up the current config. # Cloudflare, Google, Cloudflare, Google
Set-DNSClientServerAddress -InterfaceAlias "Ethernet*" -ServerAddresses ("1.1.1.1", "8.8.8.8", "2606:4700:4700::1111", "2001:4860:4860::8888")
Set-DNSClientServerAddress -InterfaceAlias "Wi-Fi*" -ServerAddresses ("1.1.1.1", "8.8.8.8", "2606:4700:4700::1111", "2001:4860:4860::8888")
}
function Disable-FastShutdownShortcut() {
Write-Status -Types "*" -Status "Removing the shortcut to shutdown the computer on the Desktop..." -Warning
Remove-ItemVerified -Path "$DesktopPath\Fast Shutdown.lnk"
}
function Enable-FastShutdownShortcut() {
$SourcePath = "$env:SystemRoot\System32\shutdown.exe"
$ShortcutPath = "$DesktopPath\Fast Shutdown.lnk"
$Description = "Turns off the computer without any prompt"
$IconLocation = "$env:SystemRoot\System32\shell32.dll, 27"
$Arguments = "-s -f -t 0"
$Hotkey = "CTRL+ALT+F12"
Write-Status -Types "+" -Status "Creating a shortcut to shutdown the computer on the Desktop..."
New-Shortcut -SourcePath $SourcePath -ShortcutPath $ShortcutPath -Description $Description -IconLocation $IconLocation -Arguments $Arguments -Hotkey $Hotkey
}
function Disable-GodMode() {
Write-Status -Types "*" -Status "Disabling God Mode hidden folder..." -Warning
Write-Host @"
###############################################################################
# _______ _______ ______ __ __ _______ ______ _______ #
# | || || | | |_| || || | | | #
# | ___|| _ || _ | | || _ || _ || ___| #
# | | __ | | | || | | | | || | | || | | || |___ #
# | || || |_| || |_| | | || |_| || |_| || ___| #
# | |_| || || | | ||_|| || || || |___ #
# |_______||_______||______| |_| |_||_______||______| |_______| #
# #
# God Mode has been disabled, link removed from your Desktop #
# #
###############################################################################
"@ -ForegroundColor Cyan
$DesktopPath = [Environment]::GetFolderPath("Desktop");
Remove-ItemVerified -Path "$DesktopPath\GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}"
}
function Enable-GodMode() {
Write-Status -Types "+" -Status "Enabling God Mode hidden folder on Desktop..."
Write-Host @"
###############################################################################
# _______ _______ ______ __ __ _______ ______ _______ #
# | || || | | |_| || || | | | #
# | ___|| _ || _ | | || _ || _ || ___| #
# | | __ | | | || | | | | || | | || | | || |___ #
# | || || |_| || |_| | | || |_| || |_| || ___| #
# | |_| || || | | ||_|| || || || |___ #
# |_______||_______||______| |_| |_||_______||______| |_______| #
# #
# God Mode has been enabled, check out the new link on your Desktop #
# #
###############################################################################
"@ -ForegroundColor Blue
$DesktopPath = [Environment]::GetFolderPath("Desktop");
New-Item -Path "$DesktopPath\GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}" -ItemType Directory -Force
}
function Disable-Hibernate() {
Write-Status -Types "-", "Performance" -Status "Disabling Hibernate (Slows boot time and deletes '$env:SystemDrive\hiberfil.sys' file)..."
powercfg -Hibernate off | Out-Host # On my PC booted up in 20s 32ms
}
function Enable-Hibernate() {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[ValidateSet('Full', 'Reduced')]
[String] $Type = 'Full'
)
Write-Status -Types "+", "Performance" -Status "Enabling Hibernate (Boots faster and generates '$env:SystemDrive\hiberfil.sys' file)..."
powercfg -Hibernate on | Out-Host # On my PC booted up in 12s 56ms Full/Reduced
# Full = Enables Hibernate power button and Fast Startup | Reduced = Enable Fast Startup only
Write-Status -Types "+", "Performance" -Status "Setting Hibernate size to $Type..."
powercfg -Hibernate -Type $Type | Out-Host
}
function Disable-InternetExplorer() {
Set-OptionalFeatureState -State 'Disabled' -OptionalFeatures @("Internet-Explorer-Optional-*")
}
function Enable-InternetExplorer() {
Set-OptionalFeatureState -State 'Enabled' -OptionalFeatures @("Internet-Explorer-Optional-*")
}
# Code from: https://answers.microsoft.com/en-us/windows/forum/all/set-the-mouse-scroll-direction-to-reverse-natural/ede4ccc4-3846-4184-a86d-a028515040c0
function Disable-MouseNaturalScroll() {
Get-PnpDevice -Class Mouse -PresentOnly -Status OK | ForEach-Object {
Write-Status -Types "*" -Status "Disabling mouse natural mode on $($_.Name): $($_.DeviceID) (requires reboot!)"
Set-ItemPropertyVerified -Path "HKLM:\SYSTEM\CurrentControlSet\Enum\$($_.DeviceID)\Device Parameters" -Name "FlipFlopWheel" -Type DWord -Value 0
}
}
function Enable-MouseNaturalScroll() {
Get-PnpDevice -Class Mouse -PresentOnly -Status OK | ForEach-Object {
Write-Status -Types "+" -Status "Enabling mouse natural mode on $($_.Name): $($_.DeviceID) (requires reboot!)"
Set-ItemPropertyVerified -Path "HKLM:\SYSTEM\CurrentControlSet\Enum\$($_.DeviceID)\Device Parameters" -Name "FlipFlopWheel" -Type DWord -Value 1
}
}
function Disable-OldVolumeControl() {
Write-Status -Types "*", "Misc" -Status "Disabling Old Volume Control..."
Remove-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\MTCUVC" -Name "EnableMtcUvc"
}
function Enable-OldVolumeControl() {
Write-Status -Types "+", "Misc" -Status "Enabling Old Volume Control..."
Set-ItemPropertyVerified -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\MTCUVC" -Name "EnableMtcUvc" -Type DWord -Value 0
}
function Disable-OnlineSpeechRecognition() {
Write-Status -Types "-", "Privacy" -Status "Disabling Online Speech Recognition..."
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Policies\Microsoft\InputPersonalization" -Name "AllowInputPersonalization" -Type DWord -Value 0
# [@] (0 = Decline, 1 = Accept)
Set-ItemPropertyVerified -Path "$PathToCUOnlineSpeech" -Name "HasAccepted" -Type DWord -Value 0
}
function Enable-OnlineSpeechRecognition() {
Write-Status -Types "+", "Privacy" -Status "Enabling Online Speech Recognition..."
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\InputPersonalization" -Name "AllowInputPersonalization"
# [@] (0 = Decline, 1 = Accept)
Set-ItemPropertyVerified -Path "$PathToCUOnlineSpeech" -Name "HasAccepted" -Type DWord -Value 1
}
function Disable-PhoneLink() {
Write-Status -Types "-", "Privacy" -Status "Disabling Phone Link (Your Phone)..."
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "$PathToLMPoliciesSystem" -Name "EnableMmx" -Type DWord -Value 0
}
function Enable-PhoneLink() {
Write-Status -Types "*", "Privacy" -Status "Enabling Phone Link (Your Phone)..."
Set-ItemPropertyVerified -Path "$PathToLMPoliciesCloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToLMPoliciesSystem" -Name "EnableMmx" -Type DWord -Value 1
}
function Disable-PowerShellISE() {
Set-CapabilityState -State Disabled -Capabilities @("Microsoft.Windows.PowerShell.ISE*")
}
function Enable-PowerShellISE() {
Set-CapabilityState -State Enabled -Capabilities @("Microsoft.Windows.PowerShell.ISE*")
}
function Disable-PrintToPDFServicesToogle() {
Set-OptionalFeatureState -State 'Disabled' -OptionalFeatures @("Printing-PrintToPDFServices-Features")
}
function Enable-PrintToPDFServicesToogle() {
Set-OptionalFeatureState -State 'Enabled' -OptionalFeatures @("Printing-PrintToPDFServices-Features")
}
function Disable-PrintingXPSServicesToogle() {
Set-OptionalFeatureState -State 'Disabled' -OptionalFeatures @("Printing-XPSServices-Features")
}
function Enable-PrintingXPSServicesToogle() {
Set-OptionalFeatureState -State 'Enabled' -OptionalFeatures @("Printing-XPSServices-Features")
}
function Disable-SearchAppForUnknownExt() {
Write-Status -Types "-", "Misc" -Status "Disabling Search for App in Store for Unknown Extensions..."
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoUseStoreOpenWith" -Type DWord -Value 1
}
function Enable-SearchAppForUnknownExt() {
Write-Status -Types "*", "Misc" -Status "Enabling Search for App in Store for Unknown Extensions..."
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoUseStoreOpenWith"
}
function Disable-Telemetry() {
Write-Status -Types "-", "Privacy" -Status "Disabling Telemetry..."
# [@] (0 = Security (Enterprise only), 1 = Basic Telemetry, 2 = Enhanced Telemetry, 3 = Full Telemetry)
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowDeviceNameInTelemetry" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Stop-Service "DiagTrack" -NoWait -Force
Set-ServiceStartup -State 'Disabled' -Services "DiagTrack"
}
function Enable-Telemetry() {
Write-Status -Types "*", "Privacy" -Status "Enabling Telemetry..."
# [@] (0 = Security (Enterprise only), 1 = Basic Telemetry, 2 = Enhanced Telemetry, 3 = Full Telemetry)
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry"
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowDeviceNameInTelemetry"
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry"
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry"
Set-ServiceStartup -State 'Manual' -Services "DiagTrack"
Start-Service "DiagTrack"
}
function Disable-WindowsMediaPlayer() {
Set-OptionalFeatureState -State 'Disabled' -OptionalFeatures @("MediaPlayback")
}
function Enable-WindowsMediaPlayer() {
Set-OptionalFeatureState -State 'Enabled' -OptionalFeatures @("MediaPlayback")
}
function Disable-WSearchService() {
Write-Status -Types "-", "Service" -Status "Disabling Search Indexing (Recommended for HDDs)..."
Get-Service -Name "WSearch" -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled
Stop-Service "WSearch" -Force -NoWait
}
function Enable-WSearchService() {
Write-Status -Types "*", "Service" -Status "Enabling Search Indexing (Recommended for SSDs)..."
Get-Service -Name "WSearch" -ErrorAction SilentlyContinue | Set-Service -StartupType Automatic
Start-Service "WSearch"
}
function Disable-XboxGameBarDVRandMode() {
# Adapted from: https://docs.microsoft.com/en-us/answers/questions/241800/completely-disable-and-remove-xbox-apps-and-relate.html
Write-Status -Types "-", "Performance" -Status "Disabling Xbox Game Bar DVR..."
Set-ItemPropertyVerified -Path "$PathToLMPoliciesAppGameDVR" -Name "value" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 0
Set-ItemPropertyVerified -Path "$PathToLMPoliciesGameDVR" -Name "AllowGameDVR" -Type DWord -Value 0
Set-ServiceStartup -State 'Disabled' -Services "BcastDVRUserService*"
Write-Status -Types "-", "Performance" -Status "Enabling Game mode..."
Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "AutoGameModeEnabled" -Type DWord -Value 0
Write-Status -Types "-", "Performance" -Status "Enabling Game Mode Notifications..."
Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "ShowGameModeNotifications" -Type DWord -Value 0
Write-Status -Types "-", "Performance" -Status "Enabling Game Bar tips..."
Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "ShowStartupPanel" -Type DWord -Value 0
Write-Status -Types "-", "Performance" -Status "Enabling Open Xbox Game Bar using Xbox button on Game Controller..."
Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "UseNexusForGameBarEnabled" -Type DWord -Value 0
Grant-RegistryPermission -Key "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter"
Write-Status -Types "-", "Performance" -Status "Disabling GameBar Presence Writer..."
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter" -Name "ActivationType" -Type DWord -Value 0
}
function Enable-XboxGameBarDVRandMode() {
Write-Status -Types "*", "Performance" -Status "Enabling Xbox Game Bar DVR..."
Write-Status -Types "*", "Performance" -Status "Removing GameDVR policies..."
Remove-ItemVerified -Path "$PathToLMPoliciesAppGameDVR" -Recurse
Set-ItemPropertyVerified -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Type DWord -Value 1
Set-ItemPropertyVerified -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Type DWord -Value 1
Remove-ItemProperty -Path "$PathToLMPoliciesGameDVR" -Name "AllowGameDVR"
Set-ServiceStartup -State 'Manual' -Services "BcastDVRUserService*"
Write-Status -Types "*", "Performance" -Status "Enabling Game mode..."
Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "AutoGameModeEnabled" -Type DWord -Value 1
Write-Status -Types "*", "Performance" -Status "Enabling Game Mode Notifications..."
Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "ShowGameModeNotifications" -Type DWord -Value 1
Write-Status -Types "*", "Performance" -Status "Enabling Game Bar tips..."
Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "ShowStartupPanel" -Type DWord -Value 1
Write-Status -Types "*", "Performance" -Status "Enabling Open Xbox Game Bar using Xbox button on Game Controller..."
Set-ItemPropertyVerified -Path "$PathToCUXboxGameBar" -Name "UseNexusForGameBarEnabled" -Type DWord -Value 1
Grant-RegistryPermission -Key "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter"
Write-Status -Types "*", "Performance" -Status "Enabling GameBar Presence Writer..."
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.GameBar.PresenceServer.Internal.PresenceWriter" -Name "ActivationType" -Type DWord -Value 1
}