-
-
Notifications
You must be signed in to change notification settings - Fork 160
/
RemoveBloat.ps1
2258 lines (1932 loc) · 95.3 KB
/
RemoveBloat.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
<#
.SYNOPSIS
.Removes bloat from a fresh Windows build
.DESCRIPTION
.Removes AppX Packages
.Disables Cortana
.Removes McAfee
.Removes HP Bloat
.Removes Dell Bloat
.Removes Lenovo Bloat
.Windows 10 and Windows 11 Compatible
.Removes any unwanted installed applications
.Removes unwanted services and tasks
.Removes Edge Surf Game
.INPUTS
.OUTPUTS
C:\ProgramData\Debloat\Debloat.log
.NOTES
Version: 5.0.15
Author: Andrew Taylor
Twitter: @AndrewTaylor_2
WWW: andrewstaylor.com
Creation Date: 08/03/2022
Purpose/Change: Initial script development
Change: 12/08/2022 - Added additional HP applications
Change 23/09/2022 - Added Clipchamp (new in W11 22H2)
Change 28/10/2022 - Fixed issue with Dell apps
Change 23/11/2022 - Added Teams Machine wide to exceptions
Change 27/11/2022 - Added Dell apps
Change 07/12/2022 - Whitelisted Dell Audio and Firmware
Change 19/12/2022 - Added Windows 11 start menu support
Change 20/12/2022 - Removed Gaming Menu from Settings
Change 18/01/2023 - Fixed Scheduled task error and cleared up $null posistioning
Change 22/01/2023 - Re-enabled Telemetry for Endpoint Analytics
Change 30/01/2023 - Added Microsoft Family to removal list
Change 31/01/2023 - Fixed Dell loop
Change 08/02/2023 - Fixed HP apps (thanks to http://gerryhampsoncm.blogspot.com/2023/02/remove-pre-installed-hp-software-during.html?m=1)
Change 08/02/2023 - Removed reg keys for Teams Chat
Change 14/02/2023 - Added HP Sure Apps
Change 07/03/2023 - Enabled Location tracking (with commenting to disable)
Change 08/03/2023 - Teams chat fix
Change 10/03/2023 - Dell array fix
Change 19/04/2023 - Added loop through all users for HKCU keys for post-OOBE deployments
Change 29/04/2023 - Removes News Feed
Change 26/05/2023 - Added Set-ACL
Change 26/05/2023 - Added multi-language support for Set-ACL commands
Change 30/05/2023 - Logic to check if gamepresencewriter exists before running Set-ACL to stop errors on re-run
Change 25/07/2023 - Added Lenovo apps (Thanks to Simon Lilly and Philip Jorgensen)
Change 31/07/2023 - Added LenovoAssist
Change 21/09/2023 - Remove Windows backup for Win10
Change 28/09/2023 - Enabled Diagnostic Tracking for Endpoint Analytics
Change 02/10/2023 - Lenovo Fix
Change 06/10/2023 - Teams chat fix
Change 09/10/2023 - Dell Command Update change
Change 11/10/2023 - Grab all uninstall strings and use native uninstaller instead of uninstall-package
Change 14/10/2023 - Updated HP Audio package name
Change 31/10/2023 - Added PowerAutomateDesktop and update Microsoft.Todos
Change 01/11/2023 - Added fix for Windows backup removing Shell Components
Change 06/11/2023 - Removes Windows CoPilot
Change 07/11/2023 - HKU fix
Change 13/11/2023 - Added CoPilot removal to .Default Users
Change 14/11/2023 - Added logic to stop errors on HP machines without HP docs installed
Change 14/11/2023 - Added logic to stop errors on Lenovo machines without some installers
Change 15/11/2023 - Code Signed for additional security
Change 02/12/2023 - Added extra logic before app uninstall to check if a user has logged in
Change 04/01/2024 - Added Dropbox and DevHome to AppX removal
Change 05/01/2024 - Added MSTSC to whitelist
Change 25/01/2024 - Added logic for LenovoNow/LenovoWelcome
Change 25/01/2024 - Updated Dell app list (thanks Hrvoje in comments)
Change 29/01/2024 - Changed /I to /X in Dell command
Change 30/01/2024 - Fix Lenovo Vantage version
Change 31/01/2024 - McAfee fix and Dell changes
Change 01/02/2024 - Dell fix
Change 01/02/2024 - Added logic around appxremoval to stop failures in logging
Change 05/02/2024 - Added whitelist parameters
Change 16/02/2024 - Added wildcard to dropbox
Change 23/02/2024 - Added Lenovo SmartMeetings
Change 06/03/2024 - Added Lenovo View and Vantage
Change 08/03/2024 - Added Lenovo Smart Noise Cancellation
Change 13/03/2024 - Added updated McAfee
Change 20/03/2024 - Dell app fixes
Change 02/04/2024 - Stopped it removing Intune Management Extension!
Change 03/04/2024 - Switched Win32 removal from whitelist to blacklist
Change 10/04/2024 - Office uninstall string fix
Change 11/04/2024 - Added Office support for multi-language
Change 17/04/2024 - HP Apps update
Change 19/04/2024 - HP Fix
Change 24/04/2024 - Switched provisionedpackage and appxpackage arround
Change 02/05/2024 - Fixed notlike to notin
Change 03/05/2024 - Change $uninstallprograms
Change 19/05/2024 - Disabled feeds on Win11
Change 21/05/2024 - Added QuickAssist to removal after security issues
Change 25/05/2024 - Whitelist array fix
Change 29/05/2025 - Uninstall fix
Change 31/05/2024 - Re-write for manufacturer bloat
Change 03/06/2024 - Added function for removing Win32 apps
Change 03/06/2024 - Added registry key to block "Tell me about this picture" icon
Change 06/06/2024 - Added keys to block Windows Recall
Change 07/06/2024 - New fixes for HP and McAfee (thanks to Keith Hay)
Change 24/06/2024 - Added Microsoft.SecHealthUI to whitelist
Change 26/06/2024 - Fix when run outside of ESP
Change 04/07/2024 - Dell fix for "|"
Change 08/07/2024 - Made whitelist more standard across platforms and removed bloat list to use only whitelisting
Change 08/07/2024 - Added start.bin
Change 12/07/2024 - Added logic around start.bin
Change 15/07/2024 - Removed Lenovo bookmarks
Change 18/07/2024 - Updated detection for removing Office Home
N/A
#>
############################################################################################################
# Initial Setup #
# #
############################################################################################################
param (
[string[]]$customwhitelist
)
##Elevate if needed
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}`" -WhitelistApps {1}" -f $PSCommandPath, ($WhitelistApps -join ',')) -Verb RunAs
Exit
}
#no errors throughout
$ErrorActionPreference = 'silentlycontinue'
#Create Folder
$DebloatFolder = "C:\ProgramData\Debloat"
If (Test-Path $DebloatFolder) {
Write-Output "$DebloatFolder exists. Skipping."
}
Else {
Write-Output "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-Output "The folder $DebloatFolder was successfully created."
}
Start-Transcript -Path "C:\ProgramData\Debloat\Debloat.log"
$locale = Get-WinSystemLocale | Select-Object -expandproperty Name
##Switch on locale to set variables
## Switch on locale to set variables
switch ($locale) {
"ar-SA" {
$everyone = "الجميع"
$builtin = "مدمج"
}
"bg-BG" {
$everyone = "Всички"
$builtin = "Вграден"
}
"cs-CZ" {
$everyone = "Všichni"
$builtin = "Vestavěný"
}
"da-DK" {
$everyone = "Alle"
$builtin = "Indbygget"
}
"de-DE" {
$everyone = "Jeder"
$builtin = "Integriert"
}
"el-GR" {
$everyone = "Όλοι"
$builtin = "Ενσωματωμένο"
}
"en-US" {
$everyone = "Everyone"
$builtin = "Builtin"
}
"en-GB" {
$everyone = "Everyone"
$builtin = "Builtin"
}
"es-ES" {
$everyone = "Todos"
$builtin = "Incorporado"
}
"et-EE" {
$everyone = "Kõik"
$builtin = "Sisseehitatud"
}
"fi-FI" {
$everyone = "Kaikki"
$builtin = "Sisäänrakennettu"
}
"fr-FR" {
$everyone = "Tout le monde"
$builtin = "Intégré"
}
"he-IL" {
$everyone = "כולם"
$builtin = "מובנה"
}
"hr-HR" {
$everyone = "Svi"
$builtin = "Ugrađeni"
}
"hu-HU" {
$everyone = "Mindenki"
$builtin = "Beépített"
}
"it-IT" {
$everyone = "Tutti"
$builtin = "Incorporato"
}
"ja-JP" {
$everyone = "すべてのユーザー"
$builtin = "ビルトイン"
}
"ko-KR" {
$everyone = "모든 사용자"
$builtin = "기본 제공"
}
"lt-LT" {
$everyone = "Visi"
$builtin = "Įmontuotas"
}
"lv-LV" {
$everyone = "Visi"
$builtin = "Iebūvēts"
}
"nb-NO" {
$everyone = "Alle"
$builtin = "Innebygd"
}
"nl-NL" {
$everyone = "Iedereen"
$builtin = "Ingebouwd"
}
"pl-PL" {
$everyone = "Wszyscy"
$builtin = "Wbudowany"
}
"pt-BR" {
$everyone = "Todos"
$builtin = "Integrado"
}
"pt-PT" {
$everyone = "Todos"
$builtin = "Incorporado"
}
"ro-RO" {
$everyone = "Toată lumea"
$builtin = "Incorporat"
}
"ru-RU" {
$everyone = "Все пользователи"
$builtin = "Встроенный"
}
"sk-SK" {
$everyone = "Všetci"
$builtin = "Vstavaný"
}
"sl-SI" {
$everyone = "Vsi"
$builtin = "Vgrajen"
}
"sr-Latn-RS" {
$everyone = "Svi"
$builtin = "Ugrađeni"
}
"sv-SE" {
$everyone = "Alla"
$builtin = "Inbyggd"
}
"th-TH" {
$everyone = "ทุกคน"
$builtin = "ภายในเครื่อง"
}
"tr-TR" {
$everyone = "Herkes"
$builtin = "Yerleşik"
}
"uk-UA" {
$everyone = "Всі"
$builtin = "Вбудований"
}
"zh-CN" {
$everyone = "所有人"
$builtin = "内置"
}
"zh-TW" {
$everyone = "所有人"
$builtin = "內建"
}
default {
$everyone = "Everyone"
$builtin = "Builtin"
}
}
############################################################################################################
# Remove AppX Packages #
# #
############################################################################################################
#Removes AppxPackages
$WhitelistedApps = @(
'Microsoft.WindowsNotepad',
'Microsoft.CompanyPortal',
'Microsoft.ScreenSketch',
'Microsoft.Paint3D',
'Microsoft.WindowsCalculator',
'Microsoft.WindowsStore',
'Microsoft.Windows.Photos',
'CanonicalGroupLimited.UbuntuonWindows',
'Microsoft.MicrosoftStickyNotes',
'Microsoft.MSPaint',
'Microsoft.WindowsCamera',
'.NET Framework',
'Microsoft.HEIFImageExtension',
'Microsoft.ScreenSketch',
'Microsoft.StorePurchaseApp',
'Microsoft.VP9VideoExtensions',
'Microsoft.WebMediaExtensions',
'Microsoft.WebpImageExtension',
'Microsoft.DesktopAppInstaller',
'WindSynthBerry',
'MIDIBerry',
'Slack',
'Microsoft.SecHealthUI',
"WavesAudio.MaxxAudioProforDell2019"
"Dell - Extension*"
"Dell, Inc. - Firmware*"
"Dell Optimizer Core"
"Dell SupportAssist Remediation"
"Dell SupportAssist OS Recovery Plugin for Dell Update"
"Dell Pair"
"Dell Display Manager 2.0"
"Dell Display Manager 2.1"
"Dell Display Manager 2.2"
"Dell Peripheral Manager"
)
##If $customwhitelist is set, split on the comma and add to whitelist
if ($customwhitelist) {
$customWhitelistApps = $customwhitelist -split ","
foreach ($whitelistapp in $customwhitelistapps) {
##Add to the array
$WhitelistedApps += $whitelistapp
}
}
#NonRemovable Apps that where getting attempted and the system would reject the uninstall, speeds up debloat and prevents 'initalizing' overlay when removing apps
$NonRemovable = @(
'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.NarratorQuickStart',
'Microsoft.Windows.ParentalControls',
'Microsoft.Windows.PeopleExperienceHost',
'Microsoft.Windows.PinningConfirmationDialog',
'Microsoft.Windows.SecHealthUI',
'Microsoft.Windows.SecureAssessmentBrowser',
'Microsoft.Windows.ShellExperienceHost',
'Microsoft.Windows.XGpuEjectDialog',
'Microsoft.XboxGameCallableUI',
'Windows.CBSPreview',
'windows.immersivecontrolpanel',
'Windows.PrintDialog',
'Microsoft.VCLibs.140.00',
'Microsoft.Services.Store.Engagement',
'Microsoft.UI.Xaml.2.0',
'*Nvidia*',
"Microsoft.AsyncTextService",
"Microsoft.UI.Xaml.CBS",
"Microsoft.Windows.CallingShellApp",
"Microsoft.Windows.OOBENetworkConnectionFlow",
"Microsoft.Windows.PrintQueueActionCenter",
"Microsoft.Windows.StartMenuExperienceHost",
"MicrosoftWindows.Client.CBS",
"MicrosoftWindows.Client.Core",
"MicrosoftWindows.UndockedDevKit",
"NcsiUwpApp",
"Microsoft.NET.Native.Runtime.2.2",
"Microsoft.NET.Native.Framework.2.2",
"Microsoft.UI.Xaml.2.8",
"Microsoft.UI.Xaml.2.7",
"Microsoft.UI.Xaml.2.3",
"Microsoft.UI.Xaml.2.4",
"Microsoft.UI.Xaml.2.1",
"Microsoft.UI.Xaml.2.2",
"Microsoft.UI.Xaml.2.5",
"Microsoft.UI.Xaml.2.6",
"Microsoft.VCLibs.140.00.UWPDesktop",
"MicrosoftWindows.Client.LKG",
"MicrosoftWindows.Client.FileExp",
"Microsoft.WindowsAppRuntime.1.5",
"Microsoft.WindowsAppRuntime.1.3",
"Microsoft.WindowsAppRuntime.1.1",
"Microsoft.WindowsAppRuntime.1.2",
"Microsoft.WindowsAppRuntime.1.4",
"Microsoft.Windows.OOBENetworkCaptivePortal",
"Microsoft.Windows.Search"
)
##Combine the two arrays
$appstoignore = $WhitelistedApps += $NonRemovable
$provisioned = Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -notin $appstoignore}
foreach ($appxprov in $provisioned) {
$packagename = $appxprov.PackageName
$displayname = $appxprov.DisplayName
write-host "Removing $displayname AppX Provisioning Package"
try {
Remove-AppxProvisionedPackage -PackageName $packagename -Online -ErrorAction SilentlyContinue
write-host "Removed $displayname AppX Provisioning Package"
}
catch {
write-host "Unable to remove $displayname AppX Provisioning Package"
}
}
$appxinstalled = Get-AppxPackage -AllUsers | Where-Object {$_.Name -notin $appstoignore}
foreach ($appxapp in $appxinstalled) {
$packagename = $appxapp.PackageFullName
$displayname = $appxapp.Name
write-host "$displayname AppX Package exists"
write-host "Removing $displayname AppX Package"
try {
Remove-AppxPackage -Package $packagename -AllUsers -ErrorAction SilentlyContinue
write-host "Removed $displayname AppX Package"
}
catch {
write-host "$displayname AppX Package does not exist"
}
}
############################################################################################################
# Remove Registry Keys #
# #
############################################################################################################
##We need to grab all SIDs to remove at user level
$UserSIDs = Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" | Select-Object -ExpandProperty PSChildName
#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
}
#Disables Windows Feedback Experience
Write-Host "Disabling Windows Feedback Experience program"
$Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
If (!(Test-Path $Advertising)) {
New-Item $Advertising
}
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)) {
New-Item $Search
}
If (Test-Path $Search) {
Set-ItemProperty $Search AllowCortana -Value 0
}
#Disables Web Search in Start Menu
Write-Host "Disabling Bing Search in Start Menu"
$WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
If (!(Test-Path $WebSearch)) {
New-Item $WebSearch
}
Set-ItemProperty $WebSearch DisableWebSearch -Value 1
##Loop through all user SIDs in the registry and disable Bing Search
foreach ($sid in $UserSIDs) {
$WebSearch = "Registry::HKU\$sid\SOFTWARE\Microsoft\Windows\CurrentVersion\Search"
If (!(Test-Path $WebSearch)) {
New-Item $WebSearch
}
Set-ItemProperty $WebSearch BingSearchEnabled -Value 0
}
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0
#Stops the Windows Feedback Experience from sending anonymous data
Write-Host "Stopping the Windows Feedback Experience program"
$Period = "HKCU:\Software\Microsoft\Siuf\Rules"
If (!(Test-Path $Period)) {
New-Item $Period
}
Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
##Loop and do the same
foreach ($sid in $UserSIDs) {
$Period = "Registry::HKU\$sid\Software\Microsoft\Siuf\Rules"
If (!(Test-Path $Period)) {
New-Item $Period
}
Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
}
#Prevents bloatware applications from returning and removes Start Menu suggestions
Write-Host "Adding Registry key to prevent bloatware apps from returning"
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
$registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
If (!(Test-Path $registryPath)) {
New-Item $registryPath
}
Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
If (!(Test-Path $registryOEM)) {
New-Item $registryOEM
}
Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
##Loop through users and do the same
foreach ($sid in $UserSIDs) {
$registryOEM = "Registry::HKU\$sid\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
If (!(Test-Path $registryOEM)) {
New-Item $registryOEM
}
Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
}
#Preping mixed Reality Portal for removal
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
}
##Loop through users and do the same
foreach ($sid in $UserSIDs) {
$Holo = "Registry::HKU\$sid\Software\Microsoft\Windows\CurrentVersion\Holographic"
If (Test-Path $Holo) {
Set-ItemProperty $Holo FirstRunSucceeded -Value 0
}
}
#Disables Wi-fi Sense
Write-Host "Disabling Wi-Fi Sense"
$WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting"
$WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots"
$WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config"
If (!(Test-Path $WifiSense1)) {
New-Item $WifiSense1
}
Set-ItemProperty $WifiSense1 Value -Value 0
If (!(Test-Path $WifiSense2)) {
New-Item $WifiSense2
}
Set-ItemProperty $WifiSense2 Value -Value 0
Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
#Disables live tiles
Write-Host "Disabling live tiles"
$Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
If (!(Test-Path $Live)) {
New-Item $Live
}
Set-ItemProperty $Live NoTileApplicationNotification -Value 1
##Loop through users and do the same
foreach ($sid in $UserSIDs) {
$Live = "Registry::HKU\$sid\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications"
If (!(Test-Path $Live)) {
New-Item $Live
}
Set-ItemProperty $Live NoTileApplicationNotification -Value 1
}
#Turns off Data Collection via the AllowTelemtry key by changing it to 0
# This is needed for Intune reporting to work, uncomment if using via other method
#Write-Host "Turning off Data Collection"
#$DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
#$DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection"
#$DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection"
#If (Test-Path $DataCollection1) {
# Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0
#}
#If (Test-Path $DataCollection2) {
# Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0
#}
#If (Test-Path $DataCollection3) {
# Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0
#}
###Enable location tracking for "find my device", uncomment if you don't need it
#Disabling Location Tracking
#Write-Host "Disabling Location Tracking"
#$SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}"
#$LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration"
#If (!(Test-Path $SensorState)) {
# New-Item $SensorState
#}
#Set-ItemProperty $SensorState SensorPermissionState -Value 0
#If (!(Test-Path $LocationConfig)) {
# New-Item $LocationConfig
#}
#Set-ItemProperty $LocationConfig Status -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 -Name PeopleBand -Value 0
}
##Loop through users and do the same
foreach ($sid in $UserSIDs) {
$People = "Registry::HKU\$sid\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People"
If (Test-Path $People) {
Set-ItemProperty $People -Name PeopleBand -Value 0
}
}
Write-Host "Disabling Cortana"
$Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
$Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
$Cortana3 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
If (!(Test-Path $Cortana1)) {
New-Item $Cortana1
}
Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
If (!(Test-Path $Cortana2)) {
New-Item $Cortana2
}
Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
If (!(Test-Path $Cortana3)) {
New-Item $Cortana3
}
Set-ItemProperty $Cortana3 HarvestContacts -Value 0
##Loop through users and do the same
foreach ($sid in $UserSIDs) {
$Cortana1 = "Registry::HKU\$sid\SOFTWARE\Microsoft\Personalization\Settings"
$Cortana2 = "Registry::HKU\$sid\SOFTWARE\Microsoft\InputPersonalization"
$Cortana3 = "Registry::HKU\$sid\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore"
If (!(Test-Path $Cortana1)) {
New-Item $Cortana1
}
Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
If (!(Test-Path $Cortana2)) {
New-Item $Cortana2
}
Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
If (!(Test-Path $Cortana3)) {
New-Item $Cortana3
}
Set-ItemProperty $Cortana3 HarvestContacts -Value 0
}
#Removes 3D Objects from the 'My Computer' submenu in explorer
Write-Host "Removing 3D Objects from explorer 'My Computer' submenu"
$Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
$Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
If (Test-Path $Objects32) {
Remove-Item $Objects32 -Recurse
}
If (Test-Path $Objects64) {
Remove-Item $Objects64 -Recurse
}
##Removes the Microsoft Feeds from displaying
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds"
$Name = "EnableFeeds"
$value = "0"
if (!(Test-Path $registryPath)) {
New-Item -Path $registryPath -Force | Out-Null
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null
}
else {
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null
}
##Kill Cortana again
Get-AppxPackage - allusers Microsoft.549981C3F5F10 | Remove AppxPackage
############################################################################################################
# Remove Learn about this picture #
# #
############################################################################################################
#Turn off Learn about this picture
Write-Host "Disabling Learn about this picture"
$picture = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel'
If (Test-Path $picture) {
Set-ItemProperty $picture -Name "{2cc5ca98-6485-489a-920e-b3e88a6ccce3}" -Value 1
}
##Loop through users and do the same
foreach ($sid in $UserSIDs) {
$picture = "Registry::HKU\$sid\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"
If (Test-Path $picture) {
Set-ItemProperty $picture -Name "{2cc5ca98-6485-489a-920e-b3e88a6ccce3}" -Value 1
}
}
############################################################################################################
# Remove Scheduled Tasks #
# #
############################################################################################################
#Disables scheduled tasks that are considered unnecessary
Write-Host "Disabling scheduled tasks"
$task1 = Get-ScheduledTask -TaskName XblGameSaveTaskLogon -ErrorAction SilentlyContinue
if ($null -ne $task1) {
Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask -ErrorAction SilentlyContinue
}
$task2 = Get-ScheduledTask -TaskName XblGameSaveTask -ErrorAction SilentlyContinue
if ($null -ne $task2) {
Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask -ErrorAction SilentlyContinue
}
$task3 = Get-ScheduledTask -TaskName Consolidator -ErrorAction SilentlyContinue
if ($null -ne $task3) {
Get-ScheduledTask Consolidator | Disable-ScheduledTask -ErrorAction SilentlyContinue
}
$task4 = Get-ScheduledTask -TaskName UsbCeip -ErrorAction SilentlyContinue
if ($null -ne $task4) {
Get-ScheduledTask UsbCeip | Disable-ScheduledTask -ErrorAction SilentlyContinue
}
$task5 = Get-ScheduledTask -TaskName DmClient -ErrorAction SilentlyContinue
if ($null -ne $task5) {
Get-ScheduledTask DmClient | Disable-ScheduledTask -ErrorAction SilentlyContinue
}
$task6 = Get-ScheduledTask -TaskName DmClientOnScenarioDownload -ErrorAction SilentlyContinue
if ($null -ne $task6) {
Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask -ErrorAction SilentlyContinue
}
############################################################################################################
# Disable Services #
# #
############################################################################################################
##Write-Host "Stopping and disabling Diagnostics Tracking Service"
#Disabling the Diagnostics Tracking Service
##Stop-Service "DiagTrack"
##Set-Service "DiagTrack" -StartupType Disabled
############################################################################################################
# Windows 11 Specific #
# #
############################################################################################################
#Windows 11 Customisations
write-host "Removing Windows 11 Customisations"
#Remove Teams Chat
$MSTeams = "MicrosoftTeams"
$WinPackage = Get-AppxPackage -allusers | Where-Object {$_.Name -eq $MSTeams}
$ProvisionedPackage = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -eq $WinPackage }
If ($null -ne $WinPackage)
{
Remove-AppxPackage -Package $WinPackage.PackageFullName -AllUsers
}
If ($null -ne $ProvisionedPackage)
{
Remove-AppxProvisionedPackage -online -Packagename $ProvisionedPackage.Packagename -AllUsers
}
##Tweak reg permissions
invoke-webrequest -uri "https://github.com/andrew-s-taylor/public/raw/main/De-Bloat/SetACL.exe" -outfile "C:\Windows\Temp\SetACL.exe"
C:\Windows\Temp\SetACL.exe -on "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" -ot reg -actn setowner -ownr "n:$everyone"
C:\Windows\Temp\SetACL.exe -on "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" -ot reg -actn ace -ace "n:$everyone;p:full"
##Stop it coming back
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Communications"
If (!(Test-Path $registryPath)) {
New-Item $registryPath
}
Set-ItemProperty $registryPath ConfigureChatAutoInstall -Value 0
##Unpin it
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat"
If (!(Test-Path $registryPath)) {
New-Item $registryPath
}
Set-ItemProperty $registryPath "ChatIcon" -Value 2
write-host "Removed Teams Chat"
##Disable Feeds
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Dsh"
If (!(Test-Path $registryPath)) {
New-Item $registryPath
}
Set-ItemProperty $registryPath "AllowNewsAndInterests" -Value 0
write-host "Disabled Feeds"
############################################################################################################
# Windows Backup App #
# #
############################################################################################################
$version = Get-CimInstance Win32_OperatingSystem | Select-Object -ExpandProperty Caption
if ($version -like "*Windows 10*") {
write-host "Removing Windows Backup"
$filepath = "C:\Windows\SystemApps\MicrosoftWindows.Client.CBS_cw5n1h2txyewy\WindowsBackup\Assets"
if (Test-Path $filepath) {
Remove-WindowsPackage -Online -PackageName "Microsoft-Windows-UserExperience-Desktop-Package~31bf3856ad364e35~amd64~~10.0.19041.3393"
##Add back snipping tool functionality
write-host "Adding Windows Shell Components"
DISM /Online /Add-Capability /CapabilityName:Windows.Client.ShellComponents~~~~0.0.1.0
write-host "Components Added"
}
write-host "Removed"
}
############################################################################################################
# Windows CoPilot #
# #
############################################################################################################
$version = Get-CimInstance Win32_OperatingSystem | Select-Object -ExpandProperty Caption
if ($version -like "*Windows 11*") {
write-host "Removing Windows Copilot"
# Define the registry key and value
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot"
$propertyName = "TurnOffWindowsCopilot"
$propertyValue = 1
# Check if the registry key exists
if (!(Test-Path $registryPath)) {
# If the registry key doesn't exist, create it
New-Item -Path $registryPath -Force | Out-Null
}
# Get the property value
$currentValue = Get-ItemProperty -Path $registryPath -Name $propertyName -ErrorAction SilentlyContinue
# Check if the property exists and if its value is different from the desired value
if ($null -eq $currentValue -or $currentValue.$propertyName -ne $propertyValue) {
# If the property doesn't exist or its value is different, set the property value
Set-ItemProperty -Path $registryPath -Name $propertyName -Value $propertyValue
}
##Grab the default user as well
$registryPath = "HKEY_USERS\.DEFAULT\Software\Policies\Microsoft\Windows\WindowsCopilot"
$propertyName = "TurnOffWindowsCopilot"
$propertyValue = 1
# Check if the registry key exists
if (!(Test-Path $registryPath)) {
# If the registry key doesn't exist, create it
New-Item -Path $registryPath -Force | Out-Null
}
# Get the property value
$currentValue = Get-ItemProperty -Path $registryPath -Name $propertyName -ErrorAction SilentlyContinue
# Check if the property exists and if its value is different from the desired value
if ($null -eq $currentValue -or $currentValue.$propertyName -ne $propertyValue) {
# If the property doesn't exist or its value is different, set the property value
Set-ItemProperty -Path $registryPath -Name $propertyName -Value $propertyValue
}
##Load the default hive from c:\users\Default\NTUSER.dat
reg load HKU\temphive "c:\users\default\ntuser.dat"
$registryPath = "registry::hku\temphive\Software\Policies\Microsoft\Windows\WindowsCopilot"
$propertyName = "TurnOffWindowsCopilot"
$propertyValue = 1
# Check if the registry key exists
if (!(Test-Path $registryPath)) {
# If the registry key doesn't exist, create it
[Microsoft.Win32.RegistryKey]$HKUCoPilot = [Microsoft.Win32.Registry]::Users.CreateSubKey("temphive\Software\Policies\Microsoft\Windows\WindowsCopilot", [Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree)
$HKUCoPilot.SetValue("TurnOffWindowsCopilot", 0x1, [Microsoft.Win32.RegistryValueKind]::DWord)
}
$HKUCoPilot.Flush()
$HKUCoPilot.Close()
[gc]::Collect()
[gc]::WaitForPendingFinalizers()
reg unload HKU\temphive
write-host "Removed"
foreach ($sid in $UserSIDs) {
$registryPath = "Registry::HKU\$sid\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot"
$propertyName = "TurnOffWindowsCopilot"
$propertyValue = 1
# Check if the registry key exists
if (!(Test-Path $registryPath)) {
# If the registry key doesn't exist, create it
New-Item -Path $registryPath -Force | Out-Null
}
# Get the property value
$currentValue = Get-ItemProperty -Path $registryPath -Name $propertyName -ErrorAction SilentlyContinue
# Check if the property exists and if its value is different from the desired value
if ($null -eq $currentValue -or $currentValue.$propertyName -ne $propertyValue) {
# If the property doesn't exist or its value is different, set the property value
Set-ItemProperty -Path $registryPath -Name $propertyName -Value $propertyValue
}
}