-
Notifications
You must be signed in to change notification settings - Fork 12
/
system.ps1
562 lines (496 loc) · 21.3 KB
/
system.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
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# Import utility functions.
Import-Module -Name "$PSScriptRoot\utility"
# Restart script as administrator.
if ((IsAdmin) -eq $False) {
if ($args[0] -eq "-elevated") {
Error "Could not execute script as administrator."
}
Write-Output "Executing script as Administrator..."
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-NoProfile -ExecutionPolicy Bypass -File "{0}" -elevated' -f ($MyInvocation.MyCommand.Definition))
Exit
}
# Initialize helper objects.
$Kernel32 = Add-Type -MemberDefinition @'
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
public static extern bool SetComputerName(String name);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
public static extern bool GetComputerName(System.Text.StringBuilder buffer, ref uint size);
'@ -Name 'Kernel32' -Namespace 'Win32' -PassThru
# Schedule reboot.
$rebootRequired = $False
# Set computer information.
$hostname = $env:ComputerName
$hostname = Read-Host -Prompt "Set host name [$hostname]"
if ($hostname -ne "") {
Write-Output "Setting host name..."
Rename-Computer -NewName "tmp-$hostname" -Force
Rename-Computer -NewName "$hostname" -Force
$rebootRequired = $True
}
function Get-NetbiosName {
$data = New-Object System.Text.StringBuilder 64
$size = $data.Capacity
if (!$Kernel32::GetComputerName($data, [ref] $size)) {
Error "Could not get bios name."
}
return $data.ToString();
}
$biosname = Get-NetbiosName
$biosname = Read-Host -Prompt "Set bios name [$biosname]"
if ($biosname -ne "") {
Write-Output "Setting bios name..."
$Kernel32::SetComputerName("$biosname");
$rebootRequired = $True
}
$username = $env:UserName
$username = Read-Host -Prompt "Set user name [$username]"
if ($username -ne "") {
Write-Output "Setting user name..."
Rename-LocalUser -Name "$env:UserName" -NewName "$username"
$rebootRequired = $True
} else {
$username = $env:UserName
}
$fullname = ([adsi]"WinNT://$env:UserDomain/$username,user").fullname
$fullname = Read-Host -Prompt "Set full name [$fullname]"
if ($fullname -ne "") {
Write-Output "Setting full name..."
Set-LocalUser -Name "$username" -FullName "$fullname"
$rebootRequired = $True
}
# Disable virtual memory.
$ComputerSystem = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges
$PhysicalMemory = [math]::Ceiling($ComputerSystem.TotalPhysicalMemory / 1024 / 1024 / 1024)
if ($PhysicalMemory -ge 16) {
if ($ComputerSystem.AutomaticManagedPagefile) {
Write-Output "Switching to manual Pagefile management..."
$ComputerSystem.AutomaticManagedPagefile = $False
$ComputerSystem.Put()
$rebootRequired = $True
}
$PageFileSetting = Get-WmiObject -Query "SELECT * FROM Win32_PageFileSetting WHERE Name LIKE '%pagefile.sys'"
if ($PageFileSetting) {
Write-Output "Setting Pagefile sizes..."
$PageFileSetting.InitialSize = 0
$PageFileSetting.MaximumSize = 0
$PageFileSetting.Put()
$rebootRequired = $True
}
$PageFile = Get-WmiObject -Query "SELECT * FROM Win32_PageFile WHERE Name LIKE '%pagefile.sys'"
if ($PageFile) {
Write-Output "Deleting Pagefile..."
$PageFile.Delete()
wmic pagefileset delete
$rebootRequired = $True
}
}
# Set system volume label.
function Get-VolumeLabel {
$LogicalDisk = Get-WmiObject -Class Win32_LogicalDisk -Filter "DeviceID='$($args[0]):'"
return $LogicalDisk.VolumeName
}
if ((Get-VolumeLabel "C") -ne "System") {
Write-Output "Setting System volume label..."
Set-Volume -DriveLetter "C" -NewFileSystemLabel "System"
$rebootRequired = $True
}
# Perform reboot.
if ($rebootRequired -eq $True) {
Reboot
}
# Import system functions.
Import-Module -Name "$PSScriptRoot\system"
# ===========================================================================================================
# Privacy Tweaks
# ===========================================================================================================
DisableTelemetry
DisableCortana
DisableWiFiSense
DisableSmartScreen
DisableWebSearch
DisableAppSuggestions
DisableActivityHistory
#DisableSensors
#DisableLocation
DisableMapUpdates
DisableFeedback
DisableTailoredExperiences
DisableAdvertisingID
#DisableWebLangList
#DisableBiometrics
#DisableCamera
#DisableMicrophone
DisableErrorReporting
SetP2PUpdateLocal
DisableDiagTrack
DisableWAPPush
EnableClearRecentFiles
DisableRecentFiles
# ===========================================================================================================
# UWP Privacy Tweaks
# ===========================================================================================================
#DisableUWPBackgroundApps
DisableUWPVoiceActivation
#DisableUWPNotifications
#DisableUWPAccountInfo
#DisableUWPContacts
#DisableUWPCalendar
DisableUWPPhoneCalls
DisableUWPCallHistory
#DisableUWPEmail
#DisableUWPTasks
DisableUWPMessaging
DisableUWPRadios
DisableUWPOtherDevices
DisableUWPDiagInfo
#DisableUWPFileSystem
DisableUWPSwapFile
# ===========================================================================================================
# Security Tweaks
# ===========================================================================================================
#SetUACHigh
DisableSharingMappedDrives
DisableAdminShares
#EnableFirewall
EnableScriptHost
HideDefenderTrayIcon
DisableCIMemoryIntegrity
DisableCtrldFolderAccess
DisableDefenderAppGuard
DisableDownloadBlocking
DisableMeltdownCompatFlag
HideAccountProtectionWarn
DisableDefenderCloud
DisableDefender
DisableBootRecovery
#EnableRecoveryAndReset
SetDEPOptOut
# ===========================================================================================================
# Network Tweaks
# ===========================================================================================================
SetCurrentNetworkPrivate
SetUnknownNetworksPrivate
DisableNetDevicesAutoInst
DisableHomeGroups
DisableSMB1
#EnableSMBServer
DisableNetBIOS
DisableLLMNR
DisableLLDP
DisableLLTD
DisableMSNetClient
#EnableQoS
#DisableIPv4
#DisableIPv6
#DisableNCSIProbe
DisableConnectionSharing
DisableRemoteAssistance
#DisableRemoteDesktop
Write-Output "Disabling scheduled tasks..."
Get-ScheduledTask -ErrorAction SilentlyContinue "XblGameSaveTaskLogon" | Disable-ScheduledTask
Get-ScheduledTask -ErrorAction SilentlyContinue "XblGameSaveTask" | Disable-ScheduledTask
Get-ScheduledTask -ErrorAction SilentlyContinue "Consolidator" | Disable-ScheduledTask
Get-ScheduledTask -ErrorAction SilentlyContinue "UsbCeip" | Disable-ScheduledTask
Get-ScheduledTask -ErrorAction SilentlyContinue "DmClient" | Disable-ScheduledTask
Get-ScheduledTask -ErrorAction SilentlyContinue "DmClientOnScenarioDownload" | Disable-ScheduledTask
# ===========================================================================================================
# Service Tweaks
# ===========================================================================================================
DisableUpdateMSRT
#DisableUpdateDriver
EnableUpdateMSProducts
DisableUpdateRestart
EnableAutoRestartSignOn
DisableSharedExperiences
DisableClipboardHistory
DisableAutoplay
DisableAutorun
DisableStorageSense
DisableDefragmentation
DisableSuperfetch
#DisableIndexing
#DisableRecycleBin
EnableNTFSLongPaths
DisableNTFSLastAccess
SetBIOSTimeUTC
DisableHibernation
DisableSleepButton
#DisableFastStartup
DisableAutoRebootOnCrash
DisableRestorePoints
vssadmin Delete Shadows /For=$env:SYSTEMDRIVE /Quiet
Write-Output "Setting display and sleep mode timeouts..."
powercfg /X monitor-timeout-ac 30
powercfg /X monitor-timeout-dc 10
powercfg /X standby-timeout-ac 0
powercfg /X standby-timeout-dc 360
# gpedit.msc > Local Computer Policy > Computer Configuration > Administrative Templates
# > Windows Components > Windows Update > Configure Automatic Updates: Enabled
Write-Output "Configuring Windows Update..."
if (!(Test-Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU")) {
New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null
}
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Type DWord -Value 0
# Configure automatic updating: 2 - Notify for download and auto install
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value 2
# [ ] Install during automatic maintenance
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AutomaticMaintenanceEnabled" -Type DWord -Value 0
# Scheduled install day: 6 - Every Friday
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "ScheduledInstallDay" -Type DWord -Value 6
# Scheduled install time: 22:00
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "ScheduledInstallTime" -Type DWord -Value 22
# [x] Install updates for other Microsoft products
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AllowMUUpdateService" -Type DWord -Value 1
# Do not wake up to install updates.
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUPowerManagement" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Schedule\Maintenance" -Name "WakeUp" -Type DWord -Value 0
# ===========================================================================================================
# UI Tweaks
# ===========================================================================================================
DisableActionCenter
HideNetworkFromLockScreen
#HideShutdownFromLockScreen
DisableAeroShake
DisableAccessibilityKeys
ShowTaskManagerDetails
ShowFileOperationsDetails
DisableFileDeleteConfirm
HideTaskbarSearch
#HideTaskView
ShowSmallTaskbarIcons
SetTaskbarCombineAlways
HideTaskbarPeopleIcon
ShowTrayIcons
#ShowSecondsInTaskbar
DisableSearchAppInStore
DisableNewAppPrompt
HideRecentlyAddedApps
#SetWinXMenuCmd
DisableShortcutInName
SetAppsDarkMode
SetSystemDarkMode
#EnableNumlock
SetSoundSchemeNone
DisableStartupSound
#DisableChangingSoundScheme
#EnableVerboseStatus
DisableF1HelpKey
Write-Output "Setting mouse pointer options..."
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSpeed" -Type String -Value "0"
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseThreshold1" -Type String -Value "0"
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseThreshold2" -Type String -Value "0"
Set-ItemProperty -Path "HKCU:\Control Panel\Mouse" -Name "MouseSensitivity" -Type String -Value "4"
Write-Output "Setting custom visual effects..."
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "DragFullWindows" -Type String -Value 1
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type String -Value 400
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Type Binary -Value ([byte[]](150,62,7,128,18,0,0,0))
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Type String -Value 1
Set-ItemProperty -Path "HKCU:\Control Panel\Keyboard" -Name "KeyboardDelay" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewAlphaSelect" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ListviewShadow" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Type DWord -Value 3
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "EnableAeroPeek" -Type DWord -Value 1
# Enable transparency.
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "EnableTransparency" -Type DWord -Value 1
# Enable dark title bars.
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "ColorPrevalence" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "AccentColor" -Type DWord -Value 0x282828
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "AccentColorInactive" -Type DWord -Value 0x282828
# ===========================================================================================================
# Explorer UI Tweaks
# ===========================================================================================================
#ShowExplorerTitleFullPath
ShowKnownExtensions
ShowHiddenFiles
#ShowSuperHiddenFiles
ShowEmptyDrives
HideFolderMergeConflicts
#EnableNavPaneExpand
HideNavPaneAllFolders
HideNavPaneLibraries
#EnableFldrSeparateProcess
#EnableRestoreFldrWindows
#HideEncCompFilesColor
DisableSharingWizard
HideSelectCheckboxes
#HideSyncNotifications
HideRecentShortcuts
SetExplorerThisPC
#HideQuickAccess
HideRecycleBinFromDesktop
#ShowThisPCOnDesktop
#ShowUserFolderOnDesktop
#ShowControlPanelOnDesktop
#ShowNetworkOnDesktop
#HideDesktopIcons
#HideBuildNumberFromDesktop
HideDesktopFromThisPC
HideDesktopFromExplorer
HideDocumentsFromThisPC
HideDocumentsFromExplorer
HideDownloadsFromThisPC
HideDownloadsFromExplorer
HideMusicFromThisPC
HideMusicFromExplorer
HidePicturesFromThisPC
HidePicturesFromExplorer
HideVideosFromThisPC
HideVideosFromExplorer
Hide3DObjectsFromThisPC
Hide3DObjectsFromExplorer
HideNetworkFromExplorer
HideIncludeInLibraryMenu
HideGiveAccessToMenu
HideShareMenu
#DisableThumbnails
#DisableThumbnailCache
DisableThumbsDBOnNetwork
# ===========================================================================================================
# Application Tweaks
# ===========================================================================================================
DisableOneDrive
UninstallOneDrive
Write-Output "Uninstalling default Microsoft applications..."
Get-AppxPackage "Microsoft.3DBuilder" | Remove-AppxPackage
Get-AppxPackage "Microsoft.AppConnector" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingFinance" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingFoodAndDrink" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingHealthAndFitness" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingMaps" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingNews" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingSports" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingTranslator" | Remove-AppxPackage
Get-AppxPackage "Microsoft.BingTravel" | Remove-AppxPackage
Get-AppxPackage "Microsoft.CommsPhone" | Remove-AppxPackage
Get-AppxPackage "Microsoft.ConnectivityStore" | Remove-AppxPackage
Get-AppxPackage "Microsoft.FreshPaint" | Remove-AppxPackage
Get-AppxPackage "Microsoft.GetHelp" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Getstarted" | Remove-AppxPackage
Get-AppxPackage "Microsoft.HelpAndTips" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Media.PlayReadyClient.2" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Messaging" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Microsoft3DViewer" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MicrosoftOfficeHub" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MicrosoftPowerBIForWindows" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MicrosoftSolitaireCollection" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MicrosoftStickyNotes" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MinecraftUWP" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MixedReality.Portal" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MoCamera" | Remove-AppxPackage
Get-AppxPackage "Microsoft.MSPaint" | Remove-AppxPackage
Get-AppxPackage "Microsoft.NetworkSpeedTest" | Remove-AppxPackage
Get-AppxPackage "Microsoft.OfficeLens" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Office.OneNote" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Office.Sway" | Remove-AppxPackage
Get-AppxPackage "Microsoft.OneConnect" | Remove-AppxPackage
Get-AppxPackage "Microsoft.People" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Print3D" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Reader" | Remove-AppxPackage
Get-AppxPackage "Microsoft.RemoteDesktop" | Remove-AppxPackage
Get-AppxPackage "Microsoft.SkypeApp" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Todos" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Wallet" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WebMediaExtensions" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Whiteboard" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsAlarms" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsCamera" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsFeedbackHub" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsMaps" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsPhone" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsReadingList" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsScan" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WindowsSoundRecorder" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WinJS.1.0" | Remove-AppxPackage
Get-AppxPackage "Microsoft.WinJS.2.0" | Remove-AppxPackage
Get-AppxPackage "Microsoft.YourPhone" | Remove-AppxPackage
Get-AppxPackage "Microsoft.ZuneMusic" | Remove-AppxPackage
Get-AppxPackage "Microsoft.ZuneVideo" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Windows.Photos" | Remove-AppxPackage # Photos
Get-AppxPackage "microsoft.windowscommunicationsapps" | Remove-AppxPackage # Mail and Calendar
Get-AppxPackage "Microsoft.BingWeather" | Remove-AppxPackage # Weather
Get-AppxPackage "Microsoft.Advertising.Xaml" | Remove-AppxPackage # Dependency for Mail and Calendar, Weather
# List remaining apps.
# Get-AppxPackage | Select Name,PackageFullName | Sort Name
#
# Uninstall unwanted apps.
# Get-AppxPackage "Microsoft.3DBuilder" | Remove-AppxPackage
UninstallThirdPartyBloat
#UninstallWindowsStore
DisableXboxFeatures
#DisableFullscreenOptims
DisableAdobeFlash
DisableEdgePreload
DisableEdgeShortcutCreation
DisableIEFirstRun
DisableFirstLogonAnimation
DisableMediaSharing
DisableMediaOnlineAccess
EnableDeveloperMode
UninstallMediaPlayer
InstallInternetExplorer
UninstallWorkFolders
UninstallHelloFace
UninstallMathRecognizer
UninstallPowerShellV2
UninstallPowerShellISE
InstallHyperV
InstallSSHClient
InstallTelnetClient
#if ((Get-NetConnectionProfile).IPv4Connectivity -contains "Internet") {
# InstallNET23
#}
RemovePhotoViewerOpenWith
#UninstallPDFPrinter
UninstallXPSPrinter
RemoveFaxPrinter
UninstallFaxAndScan
# ===========================================================================================================
# Custom Tweaks
# ===========================================================================================================
# Make the "HKCR:" registry drive available.
if (!(Test-Path "HKCR:")) {
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
}
Write-Output 'Removing "Edit with Paint 3D" from Explorer context menu.'
# reg query "HKLM\Software\Classes\SystemFileAssociations" /f "3D Edit" /s /k /e
("3mf", "bmp", "fbx", "gif", "glb", "jfif", "jpe", "jpeg", "jpg", "obj", "ply", "png", "stl", "tif", "tiff") | ForEach {
Remove-Item -Path "HKLM:\Software\Classes\SystemFileAssociations\.$_\Shell\3D Edit" -Recurse -ErrorAction SilentlyContinue -Force | Out-Null
}
Write-Output 'Removeing "Set as desktop background" from Explorer context menu.'
# reg query "HKLM\Software\Classes\SystemFileAssociations" /f "setdesktopwallpaper" /s /k /e
("bmp", "dib", "gif", "jfif", "jpe", "jpeg", "jpg", "png", "tif", "tiff", "wdp") | ForEach {
Remove-Item -Path "HKLM:\Software\Classes\SystemFileAssociations\.$_\Shell\setdesktopwallpaper" -Recurse -ErrorAction SilentlyContinue -Force | Out-Null
}
Write-Output 'Removing "AMD Radeon Software" from Explorer context menu...'
if (!(Test-Path "HKCR:\Directory\Background\shellex\ContextMenuHandlers\ACE")) {
New-Item -Path "HKCR:\Directory\Background\shellex\ContextMenuHandlers\ACE" -Force | Out-Null
}
Set-ItemProperty -Path "HKCR:\Directory\Background\shellex\ContextMenuHandlers\ACE" -Name "(Default)" -Type String -Value "--"
Write-Output "Uninstalling Microsoft Internet Printing..."
Disable-WindowsOptionalFeature -Online -FeatureName "Printing-Foundation-InternetPrinting-Client" -NoRestart -WarningAction SilentlyContinue | Out-Null
# ===========================================================================================================
# Destructive Tweaks
# ===========================================================================================================
$doUnpinStartMenuTiles = Read-Host -Prompt "Unpin all Start Menu tiles [no]"
if ($doUnpinStartMenuTiles -like "yes") {
UnpinStartMenuTiles
$rebootRequired = $True
}
$doUnpinTaskbarIcons = Read-Host -Prompt "Unpin all Taskbar icons [no]"
if ($doUnpinTaskbarIcons -like "yes") {
UnpinTaskbarIcons
$rebootRequired = $True
}
$doDisableLockScreen = Read-Host -Prompt "Disable Lock screen [no]"
if ($doDisableLockScreen -like "yes") {
DisableLockScreenBlur
DisableLockScreen
$rebootRequired = $True
}
if ($rebootRequired -eq $True) {
Reboot
}
Write-Output 'Configuration complete!'
Wait-Event
Exit