This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Windows10DebloaterGUI.ps1
1487 lines (1315 loc) · 74.8 KB
/
Windows10DebloaterGUI.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
<#
$EnableEdgePDFTakeover.Text = "Enable Edge PDF Takeover"
$EnableEdgePDFTakeover.Width = 185
$EnableEdgePDFTakeover.Height = 35
$EnableEdgePDFTakeover.Location = New-Object System.Drawing.Point(155, 260)
#>
#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.
$ErrorActionPreference = 'SilentlyContinue'
$Button = [System.Windows.MessageBoxButton]::YesNoCancel
$ErrorIco = [System.Windows.MessageBoxImage]::Error
$Ask = 'Do you want to run this as an Administrator?
Select "Yes" to Run as an Administrator
Select "No" to not run this as an Administrator
Select "Cancel" to stop the script.'
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
$Prompt = [System.Windows.MessageBox]::Show($Ask, "Run as an Administrator or not?", $Button, $ErrorIco)
Switch ($Prompt) {
#This will debloat Windows 10
Yes {
Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue."
Start-Process PowerShell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs
Exit
}
No {
Break
}
}
}
#Unnecessary Windows 10 AppX apps that will be removed by the blacklist.
$global:Bloatware = @(
"Microsoft.PPIProjection"
"Microsoft.BingNews"
"Microsoft.GetHelp"
"Microsoft.Getstarted"
"Microsoft.Messaging"
"Microsoft.Microsoft3DViewer"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.MicrosoftSolitaireCollection"
"Microsoft.NetworkSpeedTest"
"Microsoft.News" # Issue 77
"Microsoft.Office.Lens" # Issue 77
"Microsoft.Office.OneNote"
"Microsoft.Office.Sway"
"Microsoft.OneConnect"
"Microsoft.People"
"Microsoft.Print3D"
"Microsoft.RemoteDesktop" # Issue 120
"Microsoft.SkypeApp"
"Microsoft.StorePurchaseApp"
"Microsoft.Office.Todo.List" # Issue 77
"Microsoft.Whiteboard" # Issue 77
"Microsoft.WindowsAlarms"
"microsoft.windowscommunicationsapps"
"Microsoft.WindowsFeedbackHub"
"Microsoft.WindowsMaps"
"Microsoft.WindowsSoundRecorder"
"Microsoft.Xbox.TCUI"
"Microsoft.XboxApp"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxGamingOverlay"
"Microsoft.XboxIdentityProvider"
"Microsoft.XboxSpeechToTextOverlay"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
#Sponsored Windows 10 AppX Apps
#Add sponsored/featured apps to remove in the "*AppName*" format
"EclipseManager"
"ActiproSoftwareLLC"
"AdobeSystemsIncorporated.AdobePhotoshopExpress"
"Duolingo-LearnLanguagesforFree"
"PandoraMediaInc"
"CandyCrush"
"BubbleWitch3Saga"
"Wunderlist"
"Flipboard"
"Twitter"
"Facebook"
"Spotify" # Issue 123
"Minecraft"
"Royal Revolt"
"Sway" # Issue 77
"Dolby" # Issue 78
#Optional: Typically not removed but you can if you need to for some reason
#"Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe"
#"Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe"
#"Microsoft.BingWeather"
)
#Valuable Windows 10 AppX apps that most people want to keep. Protected from DeBloat All.
#Credit to /u/GavinEke for a modified version of my whitelist code
$global:WhiteListedApps = @(
"Microsoft.WindowsCalculator" # Microsoft removed legacy calculator
"Microsoft.WindowsStore" # Issue 1
"Microsoft.Windows.Photos" # Microsoft disabled/hid legacy photo viewer
"CanonicalGroupLimited.UbuntuonWindows" # Issue 10
"Microsoft.Xbox.TCUI" # Issue 25, 91 Many home users want to play games
"Microsoft.XboxApp"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxGamingOverlay" # Issue 25, 91 Many home users want to play games
"Microsoft.XboxIdentityProvider" # Issue 25, 91 Many home users want to play games
"Microsoft.XboxSpeechToTextOverlay"
"Microsoft.MicrosoftStickyNotes" # Issue 33 New functionality.
"Microsoft.MSPaint" # Issue 32 This is Paint3D, legacy paint still exists in Windows 10
"Microsoft.WindowsCamera" # Issue 65 New functionality.
"\.NET"
"Microsoft.HEIFImageExtension" # Issue 68
"Microsoft.ScreenSketch" # Issue 55: Looks like Microsoft will be axing snipping tool and using Snip & Sketch going forward
"Microsoft.StorePurchaseApp" # Issue 68
"Microsoft.VP9VideoExtensions" # Issue 68
"Microsoft.WebMediaExtensions" # Issue 68
"Microsoft.WebpImageExtension" # Issue 68
"Microsoft.DesktopAppInstaller" # Issue 68
"WindSynthBerry" # Issue 68
"MIDIBerry" # Issue 68
"Slack" # Issue 83
"*Nvidia*" # Issue 198
"Microsoft.MixedReality.Portal" # Issue 195
)
#NonRemovable Apps that where getting attempted and the system would reject the uninstall, speeds up debloat and prevents 'initalizing' overlay when removing apps
$NonRemovables = Get-AppxPackage -AllUsers | Where-Object { $_.NonRemovable -eq $true } | ForEach { $_.Name }
$NonRemovables += Get-AppxPackage | Where-Object { $_.NonRemovable -eq $true } | ForEach { $_.Name }
$NonRemovables += Get-AppxProvisionedPackage -Online | Where-Object { $_.NonRemovable -eq $true } | ForEach { $_.DisplayName }
$NonRemovables = $NonRemovables | Sort-Object -Unique
if ($NonRemovables -eq $null ) {
# the .NonRemovable property doesn't exist until version 18xx. Use a hard-coded list instead.
#WARNING: only use exact names here - no short names or wildcards
$NonRemovables = @(
"1527c705-839a-4832-9118-54d4Bd6a0c89"
"c5e2524a-ea46-4f67-841f-6a9465d9d515"
"E2A4F912-2574-4A75-9BB0-0D023378592B"
"F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE"
"InputApp"
"Microsoft.AAD.BrokerPlugin"
"Microsoft.AccountsControl"
"Microsoft.BioEnrollment"
"Microsoft.CredDialogHost"
"Microsoft.ECApp"
"Microsoft.LockApp"
"Microsoft.MicrosoftEdgeDevToolsClient"
"Microsoft.MicrosoftEdge"
"Microsoft.PPIProjection"
"Microsoft.Win32WebViewHost"
"Microsoft.Windows.Apprep.ChxApp"
"Microsoft.Windows.AssignedAccessLockApp"
"Microsoft.Windows.CapturePicker"
"Microsoft.Windows.CloudExperienceHost"
"Microsoft.Windows.ContentDeliveryManager"
"Microsoft.Windows.Cortana"
"Microsoft.Windows.HolographicFirstRun" # Added 1709
"Microsoft.Windows.NarratorQuickStart"
"Microsoft.Windows.OOBENetworkCaptivePortal" # Added 1709
"Microsoft.Windows.OOBENetworkConnectionFlow" # Added 1709
"Microsoft.Windows.ParentalControls"
"Microsoft.Windows.PeopleExperienceHost"
"Microsoft.Windows.PinningConfirmationDialog"
"Microsoft.Windows.SecHealthUI" # Issue 117 Windows Defender
"Microsoft.Windows.SecondaryTileExperience" # Added 1709
"Microsoft.Windows.SecureAssessmentBrowser"
"Microsoft.Windows.ShellExperienceHost"
"Microsoft.Windows.XGpuEjectDialog"
"Microsoft.XboxGameCallableUI" # Issue 91
"Windows.CBSPreview"
"windows.immersivecontrolpanel"
"Windows.PrintDialog"
"Microsoft.VCLibs.140.00"
"Microsoft.Services.Store.Engagement"
"Microsoft.UI.Xaml.2.0"
)
}
# import library code - located relative to this script
Function dotInclude() {
Param(
[Parameter(Mandatory)]
[string]$includeFile
)
# Look for the file in the same directory as this script
$scriptPath = $PSScriptRoot
if ( $PSScriptRoot -eq $null -and $psISE) {
$scriptPath = (Split-Path -Path $psISE.CurrentFile.FullPath)
}
if ( test-path $scriptPath\$includeFile ) {
# import and immediately execute the requested file
.$scriptPath\$includeFile
}
}
# Override built-in blacklist/whitelist with user defined lists
dotInclude 'custom-lists.ps1'
#convert to regular expression to allow for the super-useful -match operator
$global:BloatwareRegex = $global:Bloatware -join '|'
$global:WhiteListedAppsRegex = $global:WhiteListedApps -join '|'
# This form was created using POSHGUI.com a free online gui designer for PowerShell
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
$Form = New-Object system.Windows.Forms.Form
$Form.ClientSize = New-Object System.Drawing.Point(500,570)
$Form.StartPosition = 'CenterScreen'
$Form.FormBorderStyle = 'FixedSingle'
$Form.MinimizeBox = $false
$Form.MaximizeBox = $false
$Form.ShowIcon = $false
$Form.text = "Windows10Debloater"
$Form.TopMost = $false
$Form.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
$DebloatPanel = New-Object system.Windows.Forms.Panel
$DebloatPanel.height = 160
$DebloatPanel.width = 480
$DebloatPanel.Anchor = 'top,right,left'
$DebloatPanel.location = New-Object System.Drawing.Point(10,10)
$RegistryPanel = New-Object system.Windows.Forms.Panel
$RegistryPanel.height = 80
$RegistryPanel.width = 480
$RegistryPanel.Anchor = 'top,right,left'
$RegistryPanel.location = New-Object System.Drawing.Point(10,180)
$CortanaPanel = New-Object system.Windows.Forms.Panel
$CortanaPanel.height = 120
$CortanaPanel.width = 153
$CortanaPanel.Anchor = 'top,right,left'
$CortanaPanel.location = New-Object System.Drawing.Point(10,270)
$EdgePanel = New-Object system.Windows.Forms.Panel
$EdgePanel.height = 120
$EdgePanel.width = 154
$EdgePanel.Anchor = 'top,right,left'
$EdgePanel.location = New-Object System.Drawing.Point(173,270)
$DarkThemePanel = New-Object system.Windows.Forms.Panel
$DarkThemePanel.height = 120
$DarkThemePanel.width = 153
$DarkThemePanel.Anchor = 'top,right,left'
$DarkThemePanel.location = New-Object System.Drawing.Point(337,270)
$OtherPanel = New-Object system.Windows.Forms.Panel
$OtherPanel.height = 160
$OtherPanel.width = 480
$OtherPanel.Anchor = 'top,right,left'
$OtherPanel.location = New-Object System.Drawing.Point(10,400)
$Debloat = New-Object system.Windows.Forms.Label
$Debloat.text = "DEBLOAT OPTIONS"
$Debloat.AutoSize = $true
$Debloat.width = 457
$Debloat.height = 142
$Debloat.Anchor = 'top,right,left'
$Debloat.location = New-Object System.Drawing.Point(10,9)
$Debloat.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$Debloat.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$CustomizeBlacklist = New-Object system.Windows.Forms.Button
$CustomizeBlacklist.FlatStyle = 'Flat'
$CustomizeBlacklist.text = "CUSTOMISE BLOCKLIST"
$CustomizeBlacklist.width = 460
$CustomizeBlacklist.height = 30
$CustomizeBlacklist.Anchor = 'top,right,left'
$CustomizeBlacklist.location = New-Object System.Drawing.Point(10,40)
$CustomizeBlacklist.Font = New-Object System.Drawing.Font('Consolas',9)
$CustomizeBlacklist.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$RemoveAllBloatware = New-Object system.Windows.Forms.Button
$RemoveAllBloatware.FlatStyle = 'Flat'
$RemoveAllBloatware.text = "REMOVE ALL BLOATWARE"
$RemoveAllBloatware.width = 460
$RemoveAllBloatware.height = 30
$RemoveAllBloatware.Anchor = 'top,right,left'
$RemoveAllBloatware.location = New-Object System.Drawing.Point(10,80)
$RemoveAllBloatware.Font = New-Object System.Drawing.Font('Consolas',9)
$RemoveAllBloatware.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$RemoveBlacklistedBloatware = New-Object system.Windows.Forms.Button
$RemoveBlacklistedBloatware.FlatStyle = 'Flat'
$RemoveBlacklistedBloatware.text = "REMOVE BLOATWARE WITH CUSTOM BLOCKLIST"
$RemoveBlacklistedBloatware.width = 460
$RemoveBlacklistedBloatware.height = 30
$RemoveBlacklistedBloatware.Anchor = 'top,right,left'
$RemoveBlacklistedBloatware.location = New-Object System.Drawing.Point(10,120)
$RemoveBlacklistedBloatware.Font = New-Object System.Drawing.Font('Consolas',9)
$RemoveBlacklistedBloatware.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$Registry = New-Object system.Windows.Forms.Label
$Registry.text = "REGISTRY CHANGES"
$Registry.AutoSize = $true
$Registry.width = 457
$Registry.height = 142
$Registry.Anchor = 'top,right,left'
$Registry.location = New-Object System.Drawing.Point(10,10)
$Registry.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$Registry.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$RevertChanges = New-Object system.Windows.Forms.Button
$RevertChanges.FlatStyle = 'Flat'
$RevertChanges.text = "REVERT REGISTRY CHANGES"
$RevertChanges.width = 460
$RevertChanges.height = 30
$RevertChanges.Anchor = 'top,right,left'
$RevertChanges.location = New-Object System.Drawing.Point(10,40)
$RevertChanges.Font = New-Object System.Drawing.Font('Consolas',9)
$RevertChanges.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$Cortana = New-Object system.Windows.Forms.Label
$Cortana.text = "CORTANA"
$Cortana.AutoSize = $true
$Cortana.width = 457
$Cortana.height = 142
$Cortana.Anchor = 'top,right,left'
$Cortana.location = New-Object System.Drawing.Point(10,10)
$Cortana.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$Cortana.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$EnableCortana = New-Object system.Windows.Forms.Button
$EnableCortana.FlatStyle = 'Flat'
$EnableCortana.text = "ENABLE"
$EnableCortana.width = 133
$EnableCortana.height = 30
$EnableCortana.Anchor = 'top,right,left'
$EnableCortana.location = New-Object System.Drawing.Point(10,40)
$EnableCortana.Font = New-Object System.Drawing.Font('Consolas',9)
$EnableCortana.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$DisableCortana = New-Object system.Windows.Forms.Button
$DisableCortana.FlatStyle = 'Flat'
$DisableCortana.text = "DISABLE"
$DisableCortana.width = 133
$DisableCortana.height = 30
$DisableCortana.Anchor = 'top,right,left'
$DisableCortana.location = New-Object System.Drawing.Point(10,80)
$DisableCortana.Font = New-Object System.Drawing.Font('Consolas',9)
$DisableCortana.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$Edge = New-Object system.Windows.Forms.Label
$Edge.text = "EDGE PDF"
$Edge.AutoSize = $true
$Edge.width = 457
$Edge.height = 142
$Edge.Anchor = 'top,right,left'
$Edge.location = New-Object System.Drawing.Point(10,10)
$Edge.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$Edge.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$EnableEdgePDFTakeover = New-Object system.Windows.Forms.Button
$EnableEdgePDFTakeover.FlatStyle = 'Flat'
$EnableEdgePDFTakeover.text = "ENABLE"
$EnableEdgePDFTakeover.width = 134
$EnableEdgePDFTakeover.height = 30
$EnableEdgePDFTakeover.Anchor = 'top,right,left'
$EnableEdgePDFTakeover.location = New-Object System.Drawing.Point(10,40)
$EnableEdgePDFTakeover.Font = New-Object System.Drawing.Font('Consolas',9)
$EnableEdgePDFTakeover.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$DisableEdgePDFTakeover = New-Object system.Windows.Forms.Button
$DisableEdgePDFTakeover.FlatStyle = 'Flat'
$DisableEdgePDFTakeover.text = "DISABLE"
$DisableEdgePDFTakeover.width = 134
$DisableEdgePDFTakeover.height = 30
$DisableEdgePDFTakeover.Anchor = 'top,right,left'
$DisableEdgePDFTakeover.location = New-Object System.Drawing.Point(10,80)
$DisableEdgePDFTakeover.Font = New-Object System.Drawing.Font('Consolas',9)
$DisableEdgePDFTakeover.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$Theme = New-Object system.Windows.Forms.Label
$Theme.text = "DARK THEME"
$Theme.AutoSize = $true
$Theme.width = 457
$Theme.height = 142
$Theme.Anchor = 'top,right,left'
$Theme.location = New-Object System.Drawing.Point(10,10)
$Theme.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$Theme.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$EnableDarkMode = New-Object system.Windows.Forms.Button
$EnableDarkMode.FlatStyle = 'Flat'
$EnableDarkMode.text = "ENABLE"
$EnableDarkMode.width = 133
$EnableDarkMode.height = 30
$EnableDarkMode.Anchor = 'top,right,left'
$EnableDarkMode.location = New-Object System.Drawing.Point(10,40)
$EnableDarkMode.Font = New-Object System.Drawing.Font('Consolas',9)
$EnableDarkMode.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$DisableDarkMode = New-Object system.Windows.Forms.Button
$DisableDarkMode.FlatStyle = 'Flat'
$DisableDarkMode.text = "DISABLE"
$DisableDarkMode.width = 133
$DisableDarkMode.height = 30
$DisableDarkMode.Anchor = 'top,right,left'
$DisableDarkMode.location = New-Object System.Drawing.Point(10,80)
$DisableDarkMode.Font = New-Object System.Drawing.Font('Consolas',9)
$DisableDarkMode.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$Other = New-Object system.Windows.Forms.Label
$Other.text = "OTHER CHANGES & FIXES"
$Other.AutoSize = $true
$Other.width = 457
$Other.height = 142
$Other.Anchor = 'top,right,left'
$Other.location = New-Object System.Drawing.Point(10,10)
$Other.Font = New-Object System.Drawing.Font('Consolas',15,[System.Drawing.FontStyle]([System.Drawing.FontStyle]::Bold))
$Other.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$RemoveOnedrive = New-Object system.Windows.Forms.Button
$RemoveOnedrive.FlatStyle = 'Flat'
$RemoveOnedrive.text = "UNINSTALL ONEDRIVE"
$RemoveOnedrive.width = 225
$RemoveOnedrive.height = 30
$RemoveOnedrive.Anchor = 'top,right,left'
$RemoveOnedrive.location = New-Object System.Drawing.Point(10,40)
$RemoveOnedrive.Font = New-Object System.Drawing.Font('Consolas',9)
$RemoveOnedrive.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$UnpinStartMenuTiles = New-Object system.Windows.Forms.Button
$UnpinStartMenuTiles.FlatStyle = 'Flat'
$UnpinStartMenuTiles.text = "UNPIN TILES FROM START MENU"
$UnpinStartMenuTiles.width = 225
$UnpinStartMenuTiles.height = 30
$UnpinStartMenuTiles.Anchor = 'top,right,left'
$UnpinStartMenuTiles.location = New-Object System.Drawing.Point(245,40)
$UnpinStartMenuTiles.Font = New-Object System.Drawing.Font('Consolas',9)
$UnpinStartMenuTiles.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$DisableTelemetry = New-Object system.Windows.Forms.Button
$DisableTelemetry.FlatStyle = 'Flat'
$DisableTelemetry.text = "DISABLE TELEMETRY / TASKS"
$DisableTelemetry.width = 225
$DisableTelemetry.height = 30
$DisableTelemetry.Anchor = 'top,right,left'
$DisableTelemetry.location = New-Object System.Drawing.Point(10,80)
$DisableTelemetry.Font = New-Object System.Drawing.Font('Consolas',9)
$DisableTelemetry.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$RemoveRegkeys = New-Object system.Windows.Forms.Button
$RemoveRegkeys.FlatStyle = 'Flat'
$RemoveRegkeys.text = "REMOVE BLOATWARE REGKEYS"
$RemoveRegkeys.width = 225
$RemoveRegkeys.height = 30
$RemoveRegkeys.Anchor = 'top,right,left'
$RemoveRegkeys.location = New-Object System.Drawing.Point(245,80)
$RemoveRegkeys.Font = New-Object System.Drawing.Font('Consolas',9)
$RemoveRegkeys.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$InstallNet35 = New-Object system.Windows.Forms.Button
$InstallNet35.FlatStyle = 'Flat'
$InstallNet35.text = "INSTALL .NET V3.5"
$InstallNet35.width = 460
$InstallNet35.height = 30
$InstallNet35.Anchor = 'top,right,left'
$InstallNet35.location = New-Object System.Drawing.Point(10,120)
$InstallNet35.Font = New-Object System.Drawing.Font('Consolas',9)
$InstallNet35.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$Form.controls.AddRange(@($RegistryPanel,$DebloatPanel,$CortanaPanel,$EdgePanel,$DarkThemePanel,$OtherPanel))
$DebloatPanel.controls.AddRange(@($Debloat,$CustomizeBlacklist,$RemoveAllBloatware,$RemoveBlacklistedBloatware))
$RegistryPanel.controls.AddRange(@($Registry,$RevertChanges))
$CortanaPanel.controls.AddRange(@($Cortana,$EnableCortana,$DisableCortana))
$EdgePanel.controls.AddRange(@($EnableEdgePDFTakeover,$DisableEdgePDFTakeover,$Edge))
$DarkThemePanel.controls.AddRange(@($Theme,$DisableDarkMode,$EnableDarkMode))
$OtherPanel.controls.AddRange(@($Other,$RemoveOnedrive,$InstallNet35,$UnpinStartMenuTiles,$DisableTelemetry,$RemoveRegkeys))
$DebloatFolder = "C:\Temp\Windows10Debloater"
If (Test-Path $DebloatFolder) {
Write-Host "${DebloatFolder} exists. Skipping."
}
Else {
Write-Host "The folder ${DebloatFolder} doesn't exist. This folder will be used for storing logs created after the script runs. Creating now."
Start-Sleep 1
New-Item -Path "${DebloatFolder}" -ItemType Directory
Write-Host "The folder ${DebloatFolder} was successfully created."
}
Start-Transcript -OutputDirectory "${DebloatFolder}"
Write-Output "Creating System Restore Point if one does not already exist. If one does, then you will receive a warning. Please wait..."
Checkpoint-Computer -Description "Before using W10DebloaterGUI.ps1"
#region gui events {
$CustomizeBlacklist.Add_Click( {
$CustomizeForm = New-Object System.Windows.Forms.Form
$CustomizeForm.ClientSize = New-Object System.Drawing.Point(580,570)
$CustomizeForm.StartPosition = 'CenterScreen'
$CustomizeForm.FormBorderStyle = 'FixedSingle'
$CustomizeForm.MinimizeBox = $false
$CustomizeForm.MaximizeBox = $false
$CustomizeForm.ShowIcon = $false
$CustomizeForm.Text = "Customize Allowlist and Blocklist"
$CustomizeForm.TopMost = $false
$CustomizeForm.AutoScroll = $false
$CustomizeForm.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
$ListPanel = New-Object system.Windows.Forms.Panel
$ListPanel.height = 510
$ListPanel.width = 572
$ListPanel.Anchor = 'top,right,left'
$ListPanel.location = New-Object System.Drawing.Point(10,10)
$ListPanel.AutoScroll = $true
$ListPanel.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
$SaveList = New-Object System.Windows.Forms.Button
$SaveList.FlatStyle = 'Flat'
$SaveList.Text = "Save custom Allowlist and Blocklist to custom-lists.ps1"
$SaveList.width = 560
$SaveList.height = 30
$SaveList.Location = New-Object System.Drawing.Point(10, 530)
$SaveList.Font = New-Object System.Drawing.Font('Consolas',9)
$SaveList.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$CustomizeForm.controls.AddRange(@($SaveList,$ListPanel))
$SaveList.Add_Click( {
# $ErrorActionPreference = 'SilentlyContinue'
'$global:WhiteListedApps = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Encoding utf8
@($ListPanel.controls) | ForEach {
if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and !$_.Checked) {
" ""$( $_.Text )""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
}
}
')' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
'$global:Bloatware = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
@($ListPanel.controls) | ForEach {
if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and $_.Checked) {
" ""$($_.Text)""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
}
}
')' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
#Over-ride the white/blacklist with the newly saved custom list
dotInclude custom-lists.ps1
#convert to regular expression to allow for the super-useful -match operator
$global:BloatwareRegex = $global:Bloatware -join '|'
$global:WhiteListedAppsRegex = $global:WhiteListedApps -join '|'
})
Function AddAppToCustomizeForm() {
Param(
[Parameter(Mandatory)]
[int] $position,
[Parameter(Mandatory)]
[string] $appName,
[Parameter(Mandatory)]
[bool] $enabled,
[Parameter(Mandatory)]
[bool] $checked,
[Parameter(Mandatory)]
[bool] $autocheck,
[string] $notes
)
$label = New-Object System.Windows.Forms.Label
$label.Location = New-Object System.Drawing.Point(-10, (2 + $position * 25))
$label.Text = $notes
$label.Font = New-Object System.Drawing.Font('Consolas',8)
$label.Width = 260
$label.Height = 27
$Label.TextAlign = [System.Drawing.ContentAlignment]::TopRight
$label.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#888888")
$ListPanel.controls.AddRange(@($label))
$Checkbox = New-Object System.Windows.Forms.CheckBox
$Checkbox.Text = $appName
$CheckBox.Font = New-Object System.Drawing.Font('Consolas',8)
$CheckBox.FlatStyle = 'Flat'
$CheckBox.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#eeeeee")
$Checkbox.Location = New-Object System.Drawing.Point(268, (0 + $position * 25))
$Checkbox.Autosize = 1;
$Checkbox.Checked = $checked
$Checkbox.Enabled = $enabled
$CheckBox.AutoCheck = $autocheck
$ListPanel.controls.AddRange(@($CheckBox))
}
$Installed = @( (Get-AppxPackage).Name )
$Online = @( (Get-AppxProvisionedPackage -Online).DisplayName )
$AllUsers = @( (Get-AppxPackage -AllUsers).Name )
[int]$checkboxCounter = 0
ForEach ($item in $NonRemovables) {
$string = ""
if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " ConflictWhitelist" }
if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += "Installed" }
if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { $string += " AllUsers" }
if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
$string += " Non-Removable"
AddAppToCustomizeForm $checkboxCounter $item $true $false $false $string
++$checkboxCounter
}
ForEach ( $item in $global:WhiteListedApps ) {
$string = ""
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " }
if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " }
if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += "Installed" }
if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { $string += " AllUsers" }
if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
AddAppToCustomizeForm $checkboxCounter $item $true $false $true $string
++$checkboxCounter
}
ForEach ( $item in $global:Bloatware ) {
$string = ""
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " Conflict Whitelist " }
if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += "Installed" }
if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { $string += " AllUsers" }
if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
++$checkboxCounter
}
ForEach ( $item in $AllUsers ) {
$string = "NEW AllUsers"
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { continue }
if ( $null -notmatch $Installed -and $Installed -cmatch $item) { $string += " Installed" }
if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
++$checkboxCounter
}
ForEach ( $item in $Installed ) {
$string = "NEW Installed"
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { continue }
if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { continue }
if ( $null -notmatch $Online -and $Online -cmatch $item) { $string += " Online" }
AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
++$checkboxCounter
}
ForEach ( $item in $Online ) {
$string = "NEW Online "
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { continue }
if ( $null -notmatch $Installed -and $Installed -cmatch $item) { continue }
if ( $null -notmatch $AllUsers -and $AllUsers -cmatch $item) { continue }
AddAppToCustomizeForm $checkboxCounter $item $true $true $true $string
++$checkboxCounter
}
[void]$CustomizeForm.ShowDialog()
})
$RemoveBlacklistedBloatware.Add_Click( {
$ErrorActionPreference = 'SilentlyContinue'
Function DebloatBlacklist {
Write-Host "Requesting removal of $global:BloatwareRegex"
Write-Host "--- This may take a while - please be patient ---"
Get-AppxPackage | Where-Object Name -cmatch $global:BloatwareRegex | Remove-AppxPackage
Write-Host "...now starting the silent ProvisionedPackage bloatware removal..."
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -cmatch $global:BloatwareRegex | Remove-AppxProvisionedPackage -Online
Write-Host "...and the final cleanup..."
Get-AppxPackage -AllUsers | Where-Object Name -cmatch $global:BloatwareRegex | Remove-AppxPackage
}
Write-Host "`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`nRemoving blocklisted Bloatware.`n"
DebloatBlacklist
Write-Host "Bloatware removed!"
})
$RemoveAllBloatware.Add_Click( {
$ErrorActionPreference = 'SilentlyContinue'
#This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
#Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
#This is the switch parameter for running this script as a 'silent' script, for use in MDT images or any type of mass deployment without user interaction.
Function Begin-SysPrep {
Write-Host "Starting Sysprep Fixes"
# Disable Windows Store Automatic Updates
Write-Host "Adding Registry key to Disable Windows Store Automatic Updates"
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore"
If (!(Test-Path $registryPath)) {
Mkdir $registryPath
New-ItemProperty $registryPath AutoDownload -Value 2
}
Set-ItemProperty $registryPath AutoDownload -Value 2
#Stop WindowsStore Installer Service and set to Disabled
Write-Host "Stopping InstallService"
Stop-Service InstallService
Write-Host "Setting InstallService Startup to Disabled"
Set-Service InstallService -StartupType Disabled
}
Function CheckDMWService {
Param([switch]$Debloat)
If (Get-Service dmwappushservice | Where-Object { $_.StartType -eq "Disabled" }) {
Set-Service dmwappushservice -StartupType Automatic
}
If (Get-Service dmwappushservice | Where-Object { $_.Status -eq "Stopped" }) {
Start-Service dmwappushservice
}
}
Function DebloatAll {
#Removes AppxPackages
Get-AppxPackage | Where { !($_.Name -cmatch $global:WhiteListedAppsRegex) -and !($NonRemovables -cmatch $_.Name) } | Remove-AppxPackage
Get-AppxProvisionedPackage -Online | Where { !($_.DisplayName -cmatch $global:WhiteListedAppsRegex) -and !($NonRemovables -cmatch $_.DisplayName) } | Remove-AppxProvisionedPackage -Online
Get-AppxPackage -AllUsers | Where { !($_.Name -cmatch $global:WhiteListedAppsRegex) -and !($NonRemovables -cmatch $_.Name) } | Remove-AppxPackage
}
#Creates a PSDrive to be able to access the 'HKCR' tree
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
Function Remove-Keys {
#These are the registry keys that it will delete.
$Keys = @(
#Remove Background Tasks
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
#Windows File
"HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
#Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y"
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
#Scheduled Tasks to delete
"HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe"
#Windows Protocol Keys
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy"
"HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy"
#Windows Share Target
"HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0"
)
#This writes the output of each key it is removing and also removes the keys listed above.
ForEach ($Key in $Keys) {
Write-Host "Removing $Key from registry"
Remove-Item $Key -Recurse
}
}
Function Protect-Privacy {
#Creates a PSDrive to be able to access the 'HKCR' tree
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
#Disables Windows Feedback Experience
Write-Host "Disabling Windows Feedback Experience program"
$Advertising = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo'
If (Test-Path $Advertising) {
Set-ItemProperty $Advertising Enabled -Value 0
}
#Stops Cortana from being used as part of your Windows Search Function
Write-Host "Stopping Cortana from being used as part of your Windows Search Function"
$Search = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search'
If (Test-Path $Search) {
Set-ItemProperty $Search AllowCortana -Value 0
}
#Stops the Windows Feedback Experience from sending anonymous data
Write-Host "Stopping the Windows Feedback Experience program"
$Period1 = 'HKCU:\Software\Microsoft\Siuf'
$Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules'
$Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
If (!(Test-Path $Period3)) {
mkdir $Period1
mkdir $Period2
mkdir $Period3
New-ItemProperty $Period3 PeriodInNanoSeconds -Value 0
}
Write-Host "Adding Registry key to prevent bloatware apps from returning"
#Prevents bloatware applications from returning
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
If (!(Test-Path $registryPath)) {
Mkdir $registryPath
New-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
}
Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
$Holo = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic'
If (Test-Path $Holo) {
Set-ItemProperty $Holo FirstRunSucceeded -Value 0
}
#Disables live tiles
Write-Host "Disabling live tiles"
$Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
If (!(Test-Path $Live)) {
mkdir $Live
New-ItemProperty $Live NoTileApplicationNotification -Value 1
}
#Turns off Data Collection via the AllowTelemtry key by changing it to 0
Write-Host "Turning off Data Collection"
$DataCollection = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection'
If (Test-Path $DataCollection) {
Set-ItemProperty $DataCollection AllowTelemetry -Value 0
}
#Disables People icon on Taskbar
Write-Host "Disabling People icon on Taskbar"
$People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
If (Test-Path $People) {
Set-ItemProperty $People PeopleBand -Value 0
}
#Disables suggestions on start menu
Write-Host "Disabling suggestions on the Start Menu"
$Suggestions = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager'
If (Test-Path $Suggestions) {
Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 0
}
Write-Host "Disabling Bing Search when using Search via the Start Menu"
$BingSearch = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer'
If (Test-Path $BingSearch) {
Set-ItemProperty $BingSearch DisableSearchBoxSuggestions -Value 1
}
Write-Host "Removing CloudStore from registry if it exists"
$CloudStore = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore'
If (Test-Path $CloudStore) {
Stop-Process Explorer.exe -Force
Remove-Item $CloudStore -Recurse -Force
Start-Process Explorer.exe -Wait
}
#Loads the registry keys/values below into the NTUSER.DAT file which prevents the apps from redownloading. Credit to a60wattfish
reg load HKU\Default_User C:\Users\Default\NTUSER.DAT
Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0
Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name PreInstalledAppsEnabled -Value 0
Set-ItemProperty -Path Registry::HKU\Default_User\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name OemPreInstalledAppsEnabled -Value 0
reg unload HKU\Default_User
#Disables scheduled tasks that are considered unnecessary
Write-Host "Disabling scheduled tasks"
#Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Disable-ScheduledTask
Get-ScheduledTask -TaskName XblGameSaveTask | Disable-ScheduledTask
Get-ScheduledTask -TaskName Consolidator | Disable-ScheduledTask
Get-ScheduledTask -TaskName UsbCeip | Disable-ScheduledTask
Get-ScheduledTask -TaskName DmClient | Disable-ScheduledTask
Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Disable-ScheduledTask
}
Function UnpinStart {
# https://superuser.com/a/1442733
# Requires -RunAsAdministrator
$START_MENU_LAYOUT = @"
<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6" />
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
"@
$layoutFile="C:\Windows\StartMenuLayout.xml"
#Delete layout file if it already exists
If(Test-Path $layoutFile)
{
Remove-Item $layoutFile
}
#Creates the blank layout file
$START_MENU_LAYOUT | Out-File $layoutFile -Encoding ASCII
$regAliases = @("HKLM", "HKCU")
#Assign the start layout and force it to apply with "LockedStartLayout" at both the machine and user level
foreach ($regAlias in $regAliases){
$basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
$keyPath = $basePath + "\Explorer"
IF(!(Test-Path -Path $keyPath)) {
New-Item -Path $basePath -Name "Explorer"
}
Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 1
Set-ItemProperty -Path $keyPath -Name "StartLayoutFile" -Value $layoutFile
}
#Restart Explorer, open the start menu (necessary to load the new layout), and give it a few seconds to process
Stop-Process -name explorer
Start-Sleep -s 5
$wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}')
Start-Sleep -s 5
#Enable the ability to pin items again by disabling "LockedStartLayout"
foreach ($regAlias in $regAliases){
$basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
$keyPath = $basePath + "\Explorer"
Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 0
}
#Restart Explorer and delete the layout file
Stop-Process -name explorer
# Uncomment the next line to make clean start menu default for all new users
#Import-StartLayout -LayoutPath $layoutFile -MountPath $env:SystemDrive\
Remove-Item $layoutFile
}
Function CheckInstallService {
If (Get-Service InstallService | Where-Object { $_.Status -eq "Stopped" }) {
Start-Service InstallService
Set-Service InstallService -StartupType Automatic
}
}
Write-Host "Initiating Sysprep"
Begin-SysPrep
Write-Host "Removing bloatware apps."
DebloatAll
Write-Host "Removing leftover bloatware registry keys."
Remove-Keys
Write-Host "Checking to see if any Allowlisted Apps were removed, and if so re-adding them."
FixWhitelistedApps
Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning."
Protect-Privacy
Write-Host "Unpinning tiles from the Start Menu."
UnpinStart
Write-Host "Setting the 'InstallService' Windows service back to 'Started' and the Startup Type 'Automatic'."
CheckDMWService
CheckInstallService
Write-Host "Finished all tasks. `n"
} )
$RevertChanges.Add_Click( {
$ErrorActionPreference = 'SilentlyContinue'
#This function will revert the changes you made when running the Start-Debloat function.
#This line reinstalls all of the bloatware that was removed
Get-AppxPackage -AllUsers | ForEach { Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml" }
#Tells Windows to enable your advertising information.
Write-Host "Re-enabling key to show advertisement information"
$Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
If (Test-Path $Advertising) {
Set-ItemProperty $Advertising Enabled -Value 1
}
#Enables Cortana to be used as part of your Windows Search Function
Write-Host "Re-enabling Cortana to be used in your Windows Search"
$Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
If (Test-Path $Search) {
Set-ItemProperty $Search AllowCortana -Value 1
}
#Re-enables the Windows Feedback Experience for sending anonymous data
Write-Host "Re-enabling Windows Feedback Experience"
$Period = "HKCU:\Software\Microsoft\Siuf\Rules"
If (!(Test-Path $Period)) {
New-Item $Period
}
Set-ItemProperty $Period PeriodInNanoSeconds -Value 1
#Enables bloatware applications
Write-Host "Adding Registry key to allow bloatware apps to return"
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
If (!(Test-Path $registryPath)) {