-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
wor.ps1
2674 lines (2194 loc) · 164 KB
/
wor.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
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !! !!
# !! SAFE TO EDIT VALUES !!
# !! CONFIGURATION START !!
# !! !!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Edit values (Option) to your Choice
# Function = Option
# List of Options
$troubleshootInstalls = 0
# 0 = Do nothing. *Recomended.
# 1 = Enable essential stuff needed for some installations.
# Note: Set to 1 if you are having trouble installing something on you pc.
# Note: Known to fix these installations: windows language pack, Autodesk AutoCad and Appxs.
# Note: Top priority configuration, overrides other settings.
$beWifiSafe = 0
# 0 = May disable services required to use Wifi. *Recomended.
# 1 = Keep Wifi working
# Note: Top priority configuration, overrides other settings.
$beMicrophoneSafe = 0
# 0 = Disable services required to use the microphone. *Recomended.
# 1 = Keep microphone working
# Note: Top priority configuration, overrides other settings.
$beAppxSafe = 0
# 0 = Disable resources needed for Appx programs, Windows Store and online MS Office features. *Recomended.
# 1 = Will keep programs like Store and Microsoft Store working. Will Keep office online features working, like corporate login, power query, power bi workspace, "Open in app" option on sharepoint...
# Note: Top priority configuration, overrides other settings.
# Note: Will keep Windows updates active
$beXboxSafe = 0
# 0 = Disable Xbox and Windows Live Games related stuff like Game Bar. *Recomended.
# 1 = Enable it.
# Note: Top priority configuration, overrides other settings.
$beBiometricSafe = 0
# 0 = Disable biometric related stuff. *Recomended.
# 1 = Enable it.
# Note: Refers to lockscreen, fingerprint reader, illuminated IR sensor or other biometric sensors.
# Note: Top priority configuration, overrides other settings.
$beNetworkPrinterSafe = 0
# 0 = Disable network printer. *Recomended.
# 1 = Enable it.
# Note: Top priority configuration, overrides other settings.
$bePrinterSafe = 0
# 0 = Disable local printer. *Recomended.
# 1 = Enable it.
# Note: Top priority configuration, overrides other settings.
$beNetworkFolderSafe = 0
# 0 = Disable network folders. *Recomended.
# 1 = Enable it.
# Note: Top priority configuration, overrides other settings.
$beAeroPeekSafe = 0
# 0 = Disable Windows Aero Peek. *Recomended.
# 1 = Enable it to Windows defaults.
# Note: Top priority configuration, overrides other settings.
$beThumbnailSafe = 0
# 0 = Disable Windows Thumbnails. *Recomended.
# 1 = Enable it to Windows defaults.
# Note: Refers to the use of thumbnails instead of icon to some files.
# Note: Top priority configuration, overrides other settings.
$beCastSafe = 0
# 0 = Disable Casting. *Recomended.
# 1 = Enable it.
# Note: Refers to the Windows ability to Cast screen to another device and or monitor, PIP (Picture-in-picture), projecting to another device.
# Note: Top priority configuration, overrides other settings.
$beVpnPppoeSafe = 0
# 0 = Will make the system safer against DNS cache poisoning but VPN or PPPOE conns may stop working. *Recomended.
# 1 = This script will not mess with stuff required for VPN or PPPOE to work.
# Note: Set it to 1 if you pretend to use VPN, PPP conns, if the system is inside a VM or having trouble with internet.
$disableCortana = 1
# 0 = Enable Cortana
# 1 = Disable Cortana *Recomended
$legacyRightClicksMenu = 1
# 0 = Use Windows 11 right click menu
# 1 = Use legacy right click menu *Recomended
$disableStartupSound = 1
# 0 = Keep Windows 11 startup sound
# 1 = Disable Windows 11 startup sound *Recomended
$useGoogleDNS = 1
# 0 = Nothing
# 1 = Apply Google DNS to connections *Recomended.
$installNvidiaControlPanel = 1
# 0 = Remove Nvidia Appx.
# 1 = Install Nvidia control panel. *Recomended.
# Note: The script will check if your GPU vendor is Nvidia
# Note: Refers to the new Nvidia Appx. Nvidia driver install dont cames with control panel anymore.
$darkTheme = 1
# 0 = Use Windows and apps default light theme.
# 1 = Enable dark theme. *Recomended.
$disableWindowsFirewall = 1
# 0 = Enable.
# 1 = Disable. *Recomended.
$disableWindowsUpdates = 1
# 0 = Enable Windows Updates.
# 1 = Disable Windows Updates. *Recomended.
$disableTelemetry = 1
# 0 = Enable Telemetry.
# 1 = Disable Telemetry. *Recomended.
# Note: Microsoft uses telemetry to periodically collect information about Windows systems. It is possible to acquire information as the computer hardware serial number, the connection records for external storage devices, and traces of executed processes.
# Note: This tweak may cause Enterprise edition to stop receiving Windows updates.
$disableSMBServer = 0
# 0 = Enable SMB Server.
# 1 = Disable it. *Recomended.
# Note: SMB Server is used for file and printer sharing.
$disablelastaccess = 0
# 0 = Enable it.
# 1 = Disable last file access date. *Recomended.
$doQualityOfLifeStuff = 1
# 0 = Reverse system settings to default.
# 1 = Perform routines to increase quality of life. *Recomended.
$doPerformanceStuff = 1
# 0 = Reverse system settings to default.
# 1 = Perform routines to increase system performance. *Recomended.
$doPrivacyStuff = 1
# 0 = Reverse system settings to default.
# 1 = Perform routines to increase system privacy. *Recomended.
$doSecurityStuff = 1
# 0 = Reverse system settings to default.
# 1 = Perform routines to increase system security. *Recomended.
$doFingerprintPrevention = 1
# 0 = Reverse system settings to default.
# 1 = Perform routines to prevent fingerprints. *Recomended.
$disableSystemRestore = 1
# 0 = Enable system restore
# 1 = Disable system restore. *Recomended.
$disableNtfsEncryption = 1
# 0 = Enable NTFS file encryption
# 1 = Disable NTFS file encryption. *Recomended.
# NTFS file encryption is the built-in encryption tool in Windows used to encrypt files and folders on NTFS drives to protect them from unwanted access
# Disabling it can reduce the processing overhead of filesystem operations
$disableNtfsCompression = 1
# 0 = Enable NTFS file compression
# 1 = Disable NTFS file compression. *Recomended.
# Disabling it can increase performance
$disableVBS = 1
# 0 = Enable VBS
# 1 = Disable VBS. *Recomended.
# VBS (Virtualization-based security) prevent unsigned or questionable drivers and software from getting into memory
# Disabling it may have a significant performance boost, specially in games
#$powerPlan = '8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c' # (High performance)
#$powerPlan = '381b4222-f694-41f0-9685-ff5bb260df2e' # (Balanced)
#$powerPlan = 'a1841308-3541-4fab-bc81-f71556f20b4a' # (Power saver)
$powerPlan = '8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c' # (High performance)
$diskAcTimeout = 0
$diskDcTimeout = 0
$monitorAcTimeout = 10
$monitorDcTimeout = 5
$standbyAcTimeout = 0
$standbyDcTimeout = 25
$hybernateAcTimeout = 0
$hybernateDcTimeout = 0
$firefoxSettings = 1
# 0 = Keep Firefox settings unchanged.
# 1 = Apply pro Firefox settings. Disable update, cross-domain cookies... *Recomended.
$firefoxCachePath = "";
# Leave it EMPTY or...
# Define a custom folder for Firefox cache files.
# Example: "E:\\FIREFOX_CACHE";
$remove3dObjFolder = 1
# 0 = Keep 3d object folder.
# 1 = Remove 3d object folder. *Recomended.
$disableWindowsSounds = 1
# 0 = Do nothing (it won't reenable it);
# 1 = Disable Windows sound effects. *Recomended.
# If you want to re-enable it, will have to do it manually
$disablePerformanceMonitor = 1
# 0 = Do nothing;
# 1 = Disable Windows Performance Logs Monitor and clear all .etl caches. *Recomended.
$unpinStartMenu = 1
# 0 = Do nothing;
# 1 = Unpin all apps from start menu.
$unnistallWindowsDefender = 1
# 0 = Do nothing (won't re-install it);
# 1 = Unnistall Windows Defender, irreversible. Safe mode is required.
$unnistallOneDrive = 1
# 0 = Do nothing (won't re-install it);
# 1 = Unnistall.
$disableBloatware = 1
# 0 = Install Windows Bloatware that are not commented in bloatwareList array.
# 1 = Remove non commented bloatware in bloatwareList array. *Recomended.
# Note: On bloatwareList comment the lines on Appxs that you want to keep/install.
$bloatwareList = @(
# Non commented lines will be uninstalled
# Maybe userful AppX
#"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*"
#"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*"
#"*Microsoft.MSPaint*"
#"*Microsoft.MicrosoftStickyNotes*"
#"*Microsoft.Windows.Photos*"
#"*Microsoft.WindowsCalculator*"
#"*Microsoft.WindowsStore*"
#"*Microsoft.WindowsCamera*"
"*Microsoft.BingWeather*"
"MicrosoftTeams*"
# Unnecessary AppX Apps
"*Microsoft.DrawboardPDF*"
"*E2A4F912-2574-4A75-9BB0-0D023378592B*"
"*Microsoft.Appconnector*"
"Microsoft.3dbuilder"
"Microsoft.3dbuilder"
"Microsoft.BingNews"
"Microsoft.GetHelp"
"Microsoft.Getstarted"
"Microsoft.Messaging"
"*Microsoft3DViewer*"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.MicrosoftSolitaireCollection"
"Microsoft.NetworkSpeedTest"
"Microsoft.News"
"Microsoft.Office.Lens"
"Microsoft.Office.OneNote"
"Microsoft.Office.Sway"
"Microsoft.OneConnect"
"Microsoft.People"
"Microsoft.Print3D"
"Microsoft.RemoteDesktop"
"Microsoft.SkypeApp"
"Microsoft.StorePurchaseApp"
"Microsoft.Office.Todo.List"
"Microsoft.Whiteboard"
"Microsoft.WindowsAlarms"
"microsoft.windowscommunicationsapps"
"*Microsoft.WindowsFeedbackHub*"
"Microsoft.WindowsMaps"
"Microsoft.WindowsSoundRecorder"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
# Sponsored AppX
"*DolbyLaboratories.DolbyAccess*"
"*Microsoft.Asphalt8Airborne*"
"*46928bounde.EclipseManager*"
"*ActiproSoftwareLLC*"
"*AdobeSystemsIncorporated.AdobePhotoshopExpress*"
"*Duolingo-LearnLanguagesforFree*"
"*PandoraMediaInc*"
"*CandyCrush*"
"*BubbleWitch3Saga*"
"*Wunderlist*"
"*Flipboard.Flipboard*"
"*Twitter*"
"*Facebook*"
"*Spotify*"
"*Minecraft*"
"*Royal Revolt*"
"*Sway*"
"*Speed Test*"
"*FarmHeroesSaga*"
"Prime*"
"*Clipchamp*"
"*Disney*"
"*Netflix*"
"*Keeper*"
"*Instagram*"
"*Amazon*"
"*Roblox*"
"*AdobePhotoshop*"
# Special Cases
# Dont Touch
if ($beXboxSafe -eq 0) {
"Microsoft.XboxGamingOverlay"
"Microsoft.Xbox.TCUI"
"Microsoft.XboxApp"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxIdentityProvider"
"Microsoft.XboxSpeechToTextOverlay"
}
if ($beBiometricSafe -eq 0) {
"*Microsoft.BioEnrollment*"
"*Microsoft.CredDialogHost*"
"*Microsoft.ECApp*"
"*Microsoft.LockApp*"
}
if ($installNvidiaControlPanel -eq 0) {
"*NVIDIACorp.NVIDIAControlPanel*"
}
if ($beCastSafe -eq 0) {
"*Microsoft.PPIP*"
}
)
##########
# Configuration - End
##########
#--------------------------------------------------------------------------
##########
# Global Functions - Start
##########
$env:POWERSHELL_TELEMETRY_OPTOUT = 'yes';
$ErrorActionPreference = "SilentlyContinue"
Set-ExecutionPolicy unrestricted
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
Set-MpPreference -EnableControlledFolderAccess Enabled -ErrorAction SilentlyContinue | Out-Null
Function hardenPath($path, $desc) {
Write-Output ($desc)
$object = "System"
$permission = "Modify, ChangePermissions"
$FileSystemRights = [System.Security.AccessControl.FileSystemRights]$permission
$InheritanceFlag = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit"
$PropagationFlag = [System.Security.AccessControl.PropagationFlags]"None"
$AccessControlType =[System.Security.AccessControl.AccessControlType]::Allow
$Account = New-Object System.Security.Principal.NTAccount($object)
$FileSystemAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($Account, $FileSystemRights, $InheritanceFlag, $PropagationFlag, $AccessControlType)
$DirectorySecurity = Get-ACL $path
$DirectorySecurity.RemoveAccessRuleAll($FileSystemAccessRule)
Set-ACL $path -AclObject $DirectorySecurity
$Acl = Get-ACL $path
$AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule("System","FullControl","ContainerInherit,Objectinherit","none","Deny")
$Acl.AddAccessRule($AccessRule)
Set-Acl $path $Acl
}
function takeownRegistry($key) {
# TODO does not work for all root keys yet
switch ($key.split('\')[0]) {
"HKEY_CLASSES_ROOT" {
$reg = [Microsoft.Win32.Registry]::ClassesRoot
$key = $key.substring(18)
}
"HKEY_CURRENT_USER" {
$reg = [Microsoft.Win32.Registry]::CurrentUser
$key = $key.substring(18)
}
"HKEY_LOCAL_MACHINE" {
$reg = [Microsoft.Win32.Registry]::LocalMachine
$key = $key.substring(19)
}
}
# get administraor group
$admins = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-32-544")
$admins = $admins.Translate([System.Security.Principal.NTAccount])
# set owner
$key = $reg.OpenSubKey($key, "ReadWriteSubTree", "TakeOwnership")
$acl = $key.GetAccessControl()
$acl.SetOwner($admins)
$key.SetAccessControl($acl)
# set FullControl
$acl = $key.GetAccessControl()
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($admins, "FullControl", "Allow")
$acl.SetAccessRule($rule)
$key.SetAccessControl($acl)
}
Function regDelete($path, $desc) {
Write-Output ($desc)
If (Test-Path ("HKLM:\" + $path)) {
Remove-ItemProperty -Path ("HKLM:\" + $path) -Recurse -Force
}
If (Test-Path ("HKCU:\" + $path)) {
Remove-ItemProperty -Path ("HKCU:\" + $path) -Recurse -Force
}
}
Function regDeleteKey($path, $key, $desc) {
Write-Output ($desc)
If (Test-Path ("HKLM:\" + $path)) {
Remove-ItemProperty -Path ("HKLM:\" + $path) -Name $key
}
If (Test-Path ("HKCU:\" + $path)) {
Remove-ItemProperty -Path ("HKCU:\" + $path) -Name $key
}
}
Function deleteFile($path, $desc) {
Write-Output ($desc)
if (!($path | Test-Path)) {
write-Host -ForegroundColor Green ($path + " dont exists.")
return
}
takeown /F $path | out-null
$Acl = Get-ACL $path
$AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","FullControl","ContainerInherit,Objectinherit","none","Allow")
$Acl.AddAccessRule($AccessRule)
Set-Acl $path $Acl
$Acl = Get-ACL $path
$username = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule($username,"FullControl","ContainerInherit,Objectinherit","none","Allow")
$Acl.AddAccessRule($AccessRule)
Set-Acl $path $Acl
Set-ItemProperty $path -name IsReadOnly -value $false
try {
Remove-Item -Path $path -Recurse -Force -ErrorAction Stop;
write-Host -ForegroundColor Green ($path + " deleted.")
}
catch {
write-Host -ForegroundColor red ($path + " NOT deleted.")
}
}
Function deletePath($path, $desc) {
Write-Output ($desc)
if (!($path | Test-Path)) {
write-Host -ForegroundColor Green ($path + " dont exists.")
return
}
takeown /F $path | out-null
$Acl = Get-ACL $path
$AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","FullControl","ContainerInherit,Objectinherit","none","Allow")
$Acl.AddAccessRule($AccessRule)
Set-Acl $path $Acl
$Acl = Get-ACL $path
$username = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule($username,"FullControl","ContainerInherit,Objectinherit","none","Allow")
$Acl.AddAccessRule($AccessRule)
Set-Acl $path $Acl
$files = Get-ChildItem $path
foreach ($file in $files) {
$Item = $path + "\" + $file.name
takeown /F $Item | out-null
$Acl = Get-ACL $Item
$AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","FullControl","Allow")
$Acl.AddAccessRule($AccessRule)
Set-Acl $Item $Acl
$Acl = Get-ACL $Item
$username = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule($username,"FullControl","Allow")
$Acl.AddAccessRule($AccessRule)
Set-Acl $Item $Acl
$whatIs = (Get-Item $Item) -is [System.IO.DirectoryInfo]
if ($whatIs -eq $False){
Set-ItemProperty $Item -name IsReadOnly -value $false
try {
Remove-Item -Path $Item -Recurse -Force -ErrorAction Stop;
write-Host -ForegroundColor Green ($file.name + " deleted.")
}
catch {
write-Host -ForegroundColor red ($file.name + " NOT deleted.")
}
}
}
}
Function clearCaches {
regDelete "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\*" "Clearing network profiles..."
regDelete "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Managed\*" "Clearing managed network profiles..."
regDelete "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged\*" "Clearing managed network profiles..."
regDelete "SYSTEM\CurrentControlSet\Enum\USBSTOR\*" "Clearing USB history..."
regDelete "SYSTEM\CurrentControlSet\Control\usbflags\*" "Clearing USB history..."
regDelete "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Nla\Cache\Intranet\*" "Clearing intranet history..."
regDelete "Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\*" "Clearing commands history..."
regDelete "Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths\*" "Clearing typed paths cache..."
regDelete "Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\*" "Clearing recent docs cache..."
regDelete "SYSTEM\CurrentControlSet\Control\Session Manager\AppCompatCache\*" "Clearing compat cache..."
regDelete "Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\*" "Clearing mapped drives cache..."
Stop-Process -ProcessName explorer -Force
Remove-Item $env:TEMP\*.* -confirm:$false -Recurse -Force
Get-ChildItem $env:TEMP\*.* | Remove-Item -confirm:$false -Recurse -Force
Remove-Item $env:WINDIR\Prefetch\*.* -confirm:$false -Recurse -Force
Get-ChildItem $env:WINDIR\Prefetch\*.* | Remove-Item -confirm:$false -Recurse -Force
Remove-Item $env:WINDIR\*.dmp -confirm:$false -Recurse -Force
taskkill /F /IM explorer.exe
Start-Sleep -Seconds 3
deletePath "$env:LocalAppData\Microsoft\Windows\Explorer" "Clearing thumbs files cache..."
deletePath "$env:LocalAppData\Microsoft\Windows\Recent" "Clearing recent folder cache..."
deletePath "$env:LocalAppData\Microsoft\Windows\Recent\AutomaticDestinations" "Clearing automatic destinations folder cache..."
deletePath "$env:LocalAppData\Microsoft\Windows\Recent\CustomDestinations" "Clearing custom destinations folder cache..."
start explorer.exe
}
Function RegChange($path, $thing, $value, $desc, $type) {
Write-Output ($desc)
# String: Specifies a null-terminated string. Equivalent to REG_SZ.
# ExpandString: Specifies a null-terminated string that contains unexpanded references to environment variables that are expanded when the value is retrieved. Equivalent to REG_EXPAND_SZ.
# Binary: Specifies binary data in any form. Equivalent to REG_BINARY.
# DWord: Specifies a 32-bit binary number. Equivalent to REG_DWORD.
# MultiString: Specifies an array of null-terminated strings terminated by two null characters. Equivalent to REG_MULTI_SZ.
# Qword: Specifies a 64-bit binary number. Equivalent to REG_QWORD.
# Unknown: Indicates an unsupported registry data type, such as REG_RESOURCE_LIST.
$type2 = "String"
if (-not ([string]::IsNullOrEmpty($type)))
{
$type2 = $type
}
If (!(Test-Path ("HKLM:\" + $path))) {
New-Item -Path ("HKLM:\" + $path) -Force | out-null
}
If (!(Test-Path ("HKCU:\" + $path))) {
New-Item -Path ("HKCU:\" + $path) -Force | out-null
}
If (Test-Path ("HKLM:\" + $path)) {
Set-ItemProperty ("HKLM:\" + $path) $thing -Value $value -Type $type2 -PassThru:$false | out-null
}
If (Test-Path ("HKCU:\" + $path)) {
Set-ItemProperty ("HKCU:\" + $path) $thing -Value $value -Type $type2 -PassThru:$false | out-null
}
}
#This will self elevate the script so with a UAC prompt since this script needs to be run as an Administrator in order to function properly.
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue."
Start-Sleep 1
Write-Host " 3"
Start-Sleep 1
Write-Host " 2"
Start-Sleep 1
Write-Host " 1"
Start-Sleep 1
Start-Process powershell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs
Exit
}
function serviceStatus{
param($ServiceName)
Write-Output $("Checking service " + $ServiceName + " status...")
$arrService = Get-Service -Name $ServiceName
if ($arrService.Status -eq "Stopped"){
Write-Output $("Service " + $ServiceName + " is stopped.")
return "stopped"
}
}
#serviceStatus("Schedule");
function killProcess{
param($processName)
Write-Output $("Trying to close " + $processName + " ...")
for ($i=1; $i -le 10; $i++){
$firefox = Get-Process $processName -ErrorAction SilentlyContinue
if ($firefox) {
$firefox | Stop-Process -Force
Sleep 1
}
}
return
}
Function EnablePeek {
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "DisablePreviewWindow" "0" "Enabling Windows Peek Thumbnail" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "DisablePreviewDesktop" "0" "Enabling Windows Peek Desktop Preview" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\DWM" "EnableAeroPeek" "1" "Enabling Windows Peek" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "ExtendedUIHoverTime" "0" "Enabling Windows Peek Taskbar Thumbnail" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\DWM" "AlwaysHibernateThumbnails" "1" "Enabling Windows Peek Taskbar Thumbnail Cache" "DWord"
}
Function DisablePeek {
if ($beAeroPeekSafe -eq 1) {
Write-Host "Aero Peek NOT disabled because of the beAeroPeekSafe configuration" -ForegroundColor Yellow -BackgroundColor DarkGreen
return
}
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "DisablePreviewWindow" "1" "Disabling Windows Peek Thumbnail" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "DisablePreviewDesktop" "1" "Disabling Windows Peek Desktop Preview" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\DWM" "EnableAeroPeek" "0" "Disabling Windows Peek" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "ExtendedUIHoverTime" "30000" "Disabling Windows Peek Taskbar Thumbnail" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\DWM" "AlwaysHibernateThumbnails" "0" "Disabling Windows Peek Taskbar Thumbnail Cache" "DWord"
}
Function EnableThumbnail {
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "IconsOnly" "0" "Enabling Windows Thumbnail" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "DisableThumbnailCache" "0" "Enabling Windows Thumbnail" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "DisableThumbsDBOnNetworkFolders" "0" "Enabling Windows Thumbnail" "DWord"
}
Function DisableThumbnail {
if ($beThumbnailSafe -eq 1) {
Write-Host "Windows Thumbnails NOT disabled because of the beThumbnailSafe configuration" -ForegroundColor Yellow -BackgroundColor DarkGreen
return
}
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "IconsOnly" "1" "Disabling Windows Thumbnail" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "DisableThumbnailCache" "1" "Disabling Windows Thumbnail" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "DisableThumbsDBOnNetworkFolders" "1" "Disabling Windows Thumbnail" "DWord"
}
# Prefetch-files contain metadata information about the last run of the program, how many times it was run, which logical drive a program was run and dlls used.
Function EnablePrefetcher {
RegChange "SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters" "EnablePrefetcher" "3" "Enabling Prefetcher" "DWord"
}
Function DisablePrefetcher {
RegChange "SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters" "EnablePrefetcher" "0" "Disabling Prefetcher" "DWord"
}
Function EnableMemoryDump {
RegChange "SYSTEM\CurrentControlSet\Control\CrashControl" "CrashDumpEnabled" "1" "Enabling Memory Dump" "DWord"
}
Function DisableMemoryDump {
RegChange "SYSTEM\CurrentControlSet\Control\CrashControl" "CrashDumpEnabled" "0" "Disabling Memory Dump" "DWord"
}
Function GPUVendor {
Write-Output "Checking your GPU vendor..."
$myGPU = Get-WmiObject win32_VideoController
if ($myGPU.name -like '*nvidia*') {
write-host 'GPU vendor is Nvidia'
return "nvidia"
}
}
Function installDraculaNotepad {
Write-Output "Checking internet connection..."
$HTTP_Request = [System.Net.WebRequest]::Create('http://google.com')
$HTTP_Response = $HTTP_Request.GetResponse()
$HTTP_Status = [int]$HTTP_Response.StatusCode
If ($HTTP_Status -eq 200) {
Write-Output "Conected to the internet."
}
Else {
Write-Output "NOT conected to the internet."
return
}
If ($HTTP_Response -eq $null) { }
Else { $HTTP_Response.Close() }
Write-Output "Checking if Notepad++ is running..."
if((get-process "Notepad++" -ea SilentlyContinue) -eq $Null){
Write-Output "Notepad++ not running."
} else {
$restartNeeded = 1
Write-Host "Notepad++ is running and will be killed. Press any key to continue..." -ForegroundColor Yellow -BackgroundColor DarkGreen
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
killProcess("notepad++");
}
Write-Output "Downloading Dracula Theme for Notepad++..."
$url = "https://raw.githubusercontent.com/dracula/notepad-plus-plus/master/Dracula.xml"
$output = "$Env:USERPROFILE\AppData\Roaming\Notepad++\themes\Dracula.xml"
$start_time = Get-Date
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $output)
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
$file = "$Env:USERPROFILE\AppData\Roaming\Notepad++\config.xml"
$OpenTag = 'name="stylerTheme" path="'
$CloseTag = '" />'
$NewText = $OpenTag + "$Env:USERPROFILE\AppData\Roaming\Notepad++\themes\Dracula.xml" + $CloseTag
(Get-Content $file) | Foreach-Object {$_ -replace "$OpenTag.*$CloseTag", $NewText} | Set-Content $file
if ($restartNeeded -eq 1) {
Write-Output "Starting Notepad++"
Start notepad++
}
}
Function uninstallDraculaNotepad {
Write-Output "Checking if Notepad++ is running..."
if((get-process "Notepad++" -ea SilentlyContinue) -eq $Null){
Write-Output "Notepad++ not running."
} else {
$restartNeeded = 1
Write-Host "Notepad++ is running and will be killed. Press any key to continue..." -ForegroundColor Yellow -BackgroundColor DarkGreen
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
killProcess("notepad++");
}
$file = "$Env:USERPROFILE\AppData\Roaming\Notepad++\config.xml"
$OpenTag = 'name="stylerTheme" path="'
$CloseTag = '" />'
$NewText = $OpenTag + "$Env:USERPROFILE\AppData\Roaming\Notepad++\stylers.xml" + $CloseTag
(Get-Content $file) | Foreach-Object {$_ -replace "$OpenTag.*$CloseTag", $NewText} | Set-Content $file
if ($restartNeeded -eq 1) {
Write-Output "Starting Notepad++"
Start notepad++
}
}
# Link-Local Multicast Name Resolution (LLMNR) protocol, a protocol that allow name resolution without the requirement of a DNS server. LLMNR is a secondary name resolution protocol.
# With LLMNR, queries are sent using multicast over a local network link on a single subnet from a client computer to another client computer on the same subnet that also has LLMNR enabled.
# Imposes security risk for layer-4 name resolution spoofing attacks, ARP poisoning, KARMA attack and cache poisoning.
Function DisableLLMNR {
RegChange "SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" "EnableMulticast" "0" "Disabling Link-Local Multicast Name Resolution (LLMNR) protocol" "DWord"
}
Function EnableLLMNR {
RegChange "SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" "EnableMulticast" "1" "Enabling Link-Local Multicast Name Resolution (LLMNR) protocol" "DWord"
}
##########
# Global Functions - End
##########
#--------------------------------------------------------------------------
##########
# Program - Start
##########
if ($beNetworkPrinterSafe -eq 1) {
$bePrinterSafe = 1
}
if ($troubleshootInstalls -eq 1) {
RegChange "SYSTEM\CurrentControlSet\Control\Terminal Server" "fDenyTSConnections" "0" "Enabling Remote Desktop" "DWord"
RegChange "SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" "UserAuthentication" "0" "Enabling Remote Desktop" "DWord"
RegChange "SYSTEM\CurrentControlSet001\Control\Terminal Server" "fDenyTSConnections" "0" "Enabling Remote Desktop"
RegChange "SYSTEM\CurrentControlSet\Services\diagnosticshub.standardcollector.service" "Start" "2" "Disabling diagnosticshub.standardcollector.service service" "DWord"
Get-Service diagnosticshub.standardcollector.service | Set-Service -StartupType automatic
# BITS (Background Intelligent Transfer Service), its aggressive bandwidth eating will interfere with you online gameplay, work and navigation. Its aggressive disk usable will reduce your HDD or SSD lifespan
write-Host "Troubleshoot Install: Enabling BITS (Background Intelligent Transfer Service)" -ForegroundColor Green -BackgroundColor Black
Get-Service BITS | Set-Service -StartupType automatic
write-Host "DoSvc (Delivery Optimization) it overrides the windows updates opt-out user option, turn your pc into a p2p peer for Windows updates, mining your network performance and compromises your online gameplay, work and navigation." -ForegroundColor Green -BackgroundColor Black
Write-Host "Troubleshoot Install: Enabling DoSvc (Delivery Optimization)..."
Get-Service DoSvc | Set-Service -StartupType automatic
Write-Output "Troubleshoot Install: Windows firewall service enabled by registry."
New-ItemProperty -Path HKLM:SYSTEM\CurrentControlSet\Services\MpsSvc -Name Start -PropertyType DWord -Value 2 -Force -EA SilentlyContinue | Out-Null
Write-Output "Troubleshoot Install: Windows Firewall enabled by registry."
RegChange "Software\Policies\Microsoft\Windows Defender" "DisableAntiSpyware" "0" "Enabling Windows Anti Spyware - DisableAntiSpyware - Windows Firewall"
Write-Output "Troubleshoot Install: Windows Firewall enabled by Get-Service."
Get-Service MpsSvc | Set-Service -StartupType automatic
Write-Output "Troubleshoot Install: Windows Firewall enabled by Get-NetFirewallProfile."
Get-NetFirewallProfile | Set-NetFirewallProfile -Enabled True
RegChange "SYSTEM\CurrentControlSet\Services\MpsSvc" "Start" "2" "Enabling Windows Firewall service..." "DWord"
Write-Output "Troubleshoot Install: Enabling connection related dependency services."
RegChange "SYSTEM\ControlSet001\Control\WMI\AutoLogger\EventLog-Application" "Start" "1" "Enabling AutoLogger\EventLog-Application..." "DWord"
RegChange "SYSTEM\ControlSet001\Control\WMI\AutoLogger\EventLog-Security" "Start" "1" "Enabling AutoLogger\EventLog-Security..." "DWord"
RegChange "SYSTEM\ControlSet001\Control\WMI\AutoLogger\EventLog-System" "Start" "1" "Enabling AutoLogger\EventLog-System..." "DWord"
RegChange "SYSTEM\ControlSet\Control\WMI\AutoLogger\EventLog-Application" "Start" "1" "Enabling AutoLogger\EventLog-Application..." "DWord"
RegChange "SYSTEM\ControlSet\Control\WMI\AutoLogger\EventLog-Security" "Start" "1" "Enabling AutoLogger\EventLog-Security..." "DWord"
RegChange "SYSTEM\ControlSet\Control\WMI\AutoLogger\EventLog-System" "Start" "1" "Enabling AutoLogger\EventLog-System..." "DWord"
pause
}
if ($legacyRightClicksMenu -eq 0) {
regDelete "Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" "Disabling legacy right click menu..."
}
if ($legacyRightClicksMenu -eq 1) {
RegChange "Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" "(Default)" "" "Enabling legacy right click menu..." "String"
}
if ($disableStartupSound -eq 0) {
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\BootAnimation" "DisableStartupSound" "0" "Enabling Windows startup sound..." "DWord"
}
if ($disableStartupSound -eq 1) {
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\BootAnimation" "DisableStartupSound" "1" "Disabling Windows startup sound..." "DWord"
}
if ($disableCortana -eq 0) {
RegChange "SOFTWARE\Policies\Microsoft\Windows\Windows Search" "ConnectedSearchPrivacy" "1" "Setting ConnectedSearchPrivacy to 3..." "DWord"
RegChange "SOFTWARE\Policies\Microsoft\Windows\Windows Search" "ConnectedSearchUseWeb" "1" "Setting ConnectedSearchUseWeb to 0..." "DWord"
RegChange "SOFTWARE\Policies\Microsoft\Windows\Windows Search" "ConnectedSearchUseWebOverMeteredConnections" "1" "Setting ConnectedSearchUseWebOverMeteredConnections to 0..." "DWord"
RegChange "SOFTWARE\Policies\Microsoft\Windows\Windows Search" "DisableWebSearch" "1" "Disabling Cortana web search..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "CortanaEnabled" "1" "Disabling Cortana..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "BingSearchEnabled" "1" "Disabling BingSearch..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "CanCortanaBeEnabled" "1" "Setting CanCortanaBeEnabled to 0..." "DWord"
RegChange "SOFTWARE\Microsoft\Personalization\Settings" "AcceptedPrivacyPolicy" "1" "Setting AcceptedPrivacyPolicy to 0..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "DeviceHistoryEnabled" "1" "Setting DeviceHistoryEnabled to 0..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "HistoryViewEnabled" "1" "Setting HistoryViewEnabled to 0..." "DWord"
}
if ($disableCortana -eq 1) {
RegChange "SOFTWARE\Policies\Microsoft\Windows\Windows Search" "ConnectedSearchPrivacy" "0" "Setting ConnectedSearchPrivacy to 3..." "DWord"
RegChange "SOFTWARE\Policies\Microsoft\Windows\Windows Search" "ConnectedSearchUseWeb" "0" "Setting ConnectedSearchUseWeb to 0..." "DWord"
RegChange "SOFTWARE\Policies\Microsoft\Windows\Windows Search" "ConnectedSearchUseWebOverMeteredConnections" "0" "Setting ConnectedSearchUseWebOverMeteredConnections to 0..." "DWord"
RegChange "SOFTWARE\Policies\Microsoft\Windows\Windows Search" "DisableWebSearch" "1" "Disabling Cortana web search..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "CortanaEnabled" "0" "Disabling Cortana..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "BingSearchEnabled" "0" "Disabling BingSearch..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "CanCortanaBeEnabled" "0" "Setting CanCortanaBeEnabled to 0..." "DWord"
RegChange "SOFTWARE\Microsoft\Personalization\Settings" "AcceptedPrivacyPolicy" "0" "Setting AcceptedPrivacyPolicy to 0..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "DeviceHistoryEnabled" "0" "Setting DeviceHistoryEnabled to 0..." "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\Search" "HistoryViewEnabled" "0" "Setting HistoryViewEnabled to 0..." "DWord"
}
if ($disableVBS -eq 1) {
RegChange "SYSTEM\CurrentControlSet\Control\DeviceGuard" "EnableVirtualizationBasedSecurity" "0" "Disabling Virtualization-based security..." "DWord"
}
if ($disableNtfsEncryption -eq 0) {
RegChange "SYSTEM\CurrentControlSet\Policies" "NtfsDisableEncryption" "0" "Enabling NTFS file encryption..." "DWord"
}
if ($disableNtfsCompression -eq 1) {
RegChange "SYSTEM\CurrentControlSet\Policies" "NtfsDisableCompression" "1" "Disabling NTFS file compression..." "DWord"
}
if ($beXboxSafe -eq 0) {
Write-Output "Disabling Xbox features..."
Get-AppxPackage "Microsoft.XboxApp" | Remove-AppxPackage
Get-AppxPackage "Microsoft.XboxIdentityProvider" | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage "Microsoft.XboxSpeechToTextOverlay" | Remove-AppxPackage
Get-AppxPackage "Microsoft.XboxGameOverlay" | Remove-AppxPackage
Get-AppxPackage "Microsoft.XboxGamingOverlay" | Remove-AppxPackage
Get-AppxPackage "Microsoft.Xbox.TCUI" | Remove-AppxPackage
if ($(serviceStatus("Schedule")) -eq "running") {
Write-Output "Disabling Xbox scheduled tasks..."
Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
}
RegChange "Software\Microsoft\GameBar" "AutoGameModeEnabled" "0" "Disabling GameBar" "DWord"
RegChange "Software\Microsoft\GameBar" "ShowStartupPanel" "0" "Disabling Game Bar Tips" "DWord"
RegChange "System\GameConfigStore" "GameDVR_Enabled" "0" "Changing Registry key to disable Game DVR - GameDVR_Enabled" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" "AppCaptureEnabled" "0" "Changing Registry key to disable gamebarpresencewriter"
# xbox dvr causing fps issues
RegChange "SOFTWARE\Policies\Microsoft\Windows\GameDVR" "GameDVR" "0" "Disabling Xbox GameDVR..." "DWord"
}
if ($beWifiSafe -eq 1) {
RegChange "SYSTEM\CurrentControlSet\Services\RmSvc" "Start" "2" "Enabling RmSvc (Radio Management Service) service" "DWord"
Get-Service RmSvc | Set-Service -StartupType automatic
RegChange "SYSTEM\CurrentControlSet\Services\WlanSvc" "Start" "2" "Enabling WlanSvc (WLAN Autoconfig) service" "DWord"
Get-Service WlanSvc | Set-Service -StartupType automatic
}
if ($beAppxSafe -eq 0) {
RegChange "SYSTEM\CurrentControlSet\Services\InstallService" "Start" "4" "Disabling InstallService MS Store service" "DWord"
Get-Service InstallService | Set-Service -StartupType disabled
Stop-Service InstallService -Force -NoWait
RegChange "SYSTEM\ControlSet001\Services\PcaSvc" "Start" "4" "Disabling PcaSvc (Program Compatibility Assistant) service" "DWord"
Get-Service PcaSvc | Set-Service -StartupType disabled
Stop-Service PcaSvc -Force -NoWait
RegChange "SYSTEM\ControlSet001\Services\wlidsvc" "Start" "4" "Disabling wlidsvc (Microsoft Windows Live ID Service) service" "DWord"
Get-Service wlidsvc | Set-Service -StartupType disabled
Stop-Service wlidsvc -Force -NoWait
#TokenBroker required for night light windows feature
#RegChange "SYSTEM\CurrentControlSet\Services\TokenBroker" "Start" "4" "Disabling TokenBroker (Windows Store permission manager) service" "DWord"
#Get-Service TokenBroker | Set-Service -StartupType disabled
#Stop-Service TokenBroker -Force -NoWait
}
if ($beAppxSafe -eq 1) {
RegChange "SYSTEM\CurrentControlSet\Services\InstallService" "Start" "2" "Enabling InstallService MS Store service" "DWord"
Get-Service InstallService | Set-Service -StartupType automatic
Start-Service InstallService -Force -NoWait
RegChange "SYSTEM\CurrentControlSet\Services\TokenBroker" "Start" "2" "Enabling TokenBroker (Windows Store permission manager) service" "DWord"
Get-Service TokenBroker | Set-Service -StartupType automatic
Start-Service TokenBroker -Force -NoWait
RegChange "SYSTEM\ControlSet001\Services\wlidsvc" "Start" "2" "Enabling wlidsvc (Microsoft Windows Live ID Service) service" "DWord"
Get-Service wlidsvc | Set-Service -StartupType automatic
Start-Service wlidsvc -Force -NoWait
RegChange "SYSTEM\ControlSet001\Services\PcaSvc" "Start" "2" "Enabling PcaSvc (Program Compatibility Assistant) service" "DWord"
Get-Service PcaSvc | Set-Service -StartupType automatic
Start-Service PcaSvc -Force -NoWait
}
if ($beXboxSafe -eq 1) {
$safeXboxBloatware = @(
"Microsoft.XboxGamingOverlay"
"Microsoft.Xbox.TCUI"
"Microsoft.XboxApp"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxIdentityProvider"
"Microsoft.XboxSpeechToTextOverlay"
)
foreach ($safeXboxBloatware1 in $safeXboxBloatware) {
Write-Output "Trying to install $safeXboxBloatware1."
Get-AppxPackage -Name $safeXboxBloatware1| Add-AppxPackage
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $safeXboxBloatware1 | Add-AppxProvisionedPackage -Online
}
RegChange "System\GameConfigStore" "GameDVR_Enabled" "1" "Changing Registry key to ENABLE Game DVR - GameDVR_Enabled" "DWord"
RegChange "SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" "AppCaptureEnabled" "1" "Changing Registry key to ENABLE gamebarpresencewriter"
# The Game bar is a Xbox app Game DVR feature that makes it simple to take control of your gaming activities—such as broadcasting, capturing clips, and sharing captures
# (delete) = Enable
# 0 = Disable
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowGameDVR" -ErrorAction SilentlyContinue
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\GameBar" -Name "AutoGameModeEnabled" -ErrorAction SilentlyContinue
if ($(serviceStatus("Schedule")) -eq "running") {
Write-Output "Enabling Xbox scheduled tasks..."
Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask
Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask
}
RegChange "Software\Microsoft\GameBar" "ShowStartupPanel" "1" "Enabling Game Bar Tips" "DWord"
}
if ($beBiometricSafe -eq 1) {
$safebeBiometricSafe = @(
"*Microsoft.BioEnrollment*"
"*Microsoft.CredDialogHost*"
"*Microsoft.ECApp*"
"*Microsoft.LockApp*"
)
foreach ($safebeBiometricSafe1 in $safebeBiometricSafe) {
Get-AppxPackage -Name $safebeBiometricSafe1| Add-AppxPackage
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $safebeBiometricSafe1 | Add-AppxProvisionedPackage -Online
Write-Output "Trying to install $safebeBiometricSafe1."
}
}
if ($beCastSafe -eq 1) {
Write-Output "Trying to install Microsoft.PPIP."
Get-AppxPackage -Name "*Microsoft.PPIP*" | Add-AppxPackage
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*Microsoft.PPIP*" | Add-AppxProvisionedPackage -Online
}
if ($beVpnPppoeSafe -eq 1) {
RegChange "SYSTEM\CurrentControlSet\services\Dnscache" "Start" "2" "Enabling DNS Cache Service" "DWord"
}
if (GPUVendor -eq "nvidia" -and installNvidiaControlPanel -eq 1) {
Get-AppxPackage -Name "*NVIDIACorp.NVIDIAControlPanel*" | Add-AppxPackage
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*NVIDIACorp.NVIDIAControlPanel*" | Add-AppxProvisionedPackage -Online
Write-Output "Trying to install Nvidia control panel."
}
# SMB Server is known for opening doors for mass ransomware attacks - WannaCry and NotPetya
if ($disableSMBServer -eq 0) {