-
Notifications
You must be signed in to change notification settings - Fork 1
/
resume.psm1
1422 lines (1192 loc) · 66 KB
/
resume.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
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
##########
#region Priority
##########
Function Priority {
$ErrorActionPreference = 'SilentlyContinue'
New-PSDrive -PSProvider Registry -Name HKCU -Root HKEY_CURRENT_USER | Out-Null
New-PSDrive -PSProvider Registry -Name HKLM -Root HKEY_LOCAL_MACHINE | Out-Null
New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS | Out-Null
New-PSDrive -Name "HKCR" -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" | Out-Null
}
Priority
Function Silent {
$Global:ProgressPreference = 'SilentlyContinue'
}
##########
#endregion Priority
##########
$wingetWarnings = @()
Function InstallSoftwares {
Write-Host "---------Adjusting System Settings" -ForegroundColor Blue -BackgroundColor Gray
Write-Host "Chapter completed."
Write-Host `n"---------Adjusting Privacy Settings" -ForegroundColor Blue -BackgroundColor Gray
Write-Host "Chapter completed."
Write-Host `n"---------Installing Softwares" -ForegroundColor Blue -BackgroundColor Gray
Write-Host `n"Installing/upgrading winget..." -NoNewline
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
# Create a directory for logs
New-Item -Path "C:\packages-logs" -ItemType Directory -Force | Out-Null
$appsToClose = @{
"github-desktop" = "GithubDesktop";
"cloudflare-warp" = "Cloudflare WARP"
}
# This script block will continuously check for specified processes and stop them if found
$scriptBlock = {
Param($processNames)
while ($true) {
foreach ($process in $processNames) {
Get-Process | Where-Object { $_.Name -eq $process } | Stop-Process -Force -ErrorAction SilentlyContinue
}
Start-Sleep -Seconds 2
}
}
# Start the background job for monitoring and stopping processes
$job = Start-Job -ScriptBlock $scriptBlock -ArgumentList $appsToClose.Values
$jsonContent = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/caglaryalcin/after-format/main/files/apps/winget.json"
$packages = $jsonContent.Sources.Packages
foreach ($pkg in $packages) {
$packageName = $pkg.PackageIdentifier
$installerType = $pkg.InstallerType
Write-Host "Installing $packageName..." -NoNewLine
# Install the packages
Start-Sleep -Milliseconds 5
if ($installerType) {
$result = & winget install $packageName -e --installer-type $installerType --silent --accept-source-agreements --accept-package-agreements --force 2>&1 | Out-String
}
else {
$result = & winget install $packageName -e --silent --accept-source-agreements --accept-package-agreements --force 2>&1 | Out-String
}
# Check if the installation was successful
if ($LASTEXITCODE -ne 0 -or $result -match "does not match" -or $result -match "fail") {
Write-Host "[WARNING]" -ForegroundColor Red -BackgroundColor Black
$wingetWarnings += $packageName
$logFile = "C:\packages-logs\${packageName}_winget_install.log"
$result | Out-File -FilePath $logFile -Force
Write-Host "[Check the log file at $logFile for details.]"
}
else {
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
}
# Once all installations are done, stop the background job
Stop-Job -Job $job
Remove-Job -Job $job
# Kill the processes of power toys
$processName = "PowerToys*"
while ($true) {
Start-Sleep -Seconds 2
$process = Get-Process -Name $processName -ErrorAction SilentlyContinue
if ($process) {
Stop-Process -Id $process.Id -Force
break
}
}
}
InstallSoftwares
Function Get-InstalledProgram {
param (
[Parameter(Mandatory = $true)]
[string]$programName
)
if ($wingetWarnings -contains $programName) {
return $true
}
$installedProgram = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall,
HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall,
HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty |
Where-Object { $_.DisplayName -like "*$programName*" } |
Select-Object -First 1
if (-not $installedProgram) {
$installedProgram = Get-AppxPackage | Where-Object { $_.Name -like "*$programName*" } | Select-Object -First 1
}
# check other paths
$paths = @(
'C:\programdata\',
'C:\Program Files (x86)\',
'C:\Program Files\'
)
foreach ($path in $paths) {
if (-not $installedProgram) {
$chocoPrograms = Get-ChildItem -Path $path -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -like "*$programName*" }
if ($null -ne $chocoPrograms -and $chocoPrograms.Count -gt 0) {
$installedProgram = $true
break
}
}
}
return $null -ne $installedProgram
}
Write-Host `n"----------------" -ForegroundColor Yellow
Write-Host @"
Detecting programs that cannot be installed with winget...
"@
Function chocoinstall {
$chocoExecutablePath = Join-Path -Path 'C:\ProgramData\chocolatey\bin' -ChildPath 'choco.exe'
if (-not (Test-Path -Path $chocoExecutablePath)) {
try {
Write-Host "Installing Chocolatey..." -NoNewline
# Disable Chocolatey's first run customization
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Internet Explorer\Main")) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Internet Explorer\Main" -Force | Out-Null
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Internet Explorer\Main" -Name "DisableFirstRunCustomize" -Value 1 -Type DWord
# Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) *>$null
Start-Sleep 10
# Check if Chocolatey is installed
if (Test-Path -Path $chocoExecutablePath) {
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
else {
$errorMessage = "Chocolatey installation failed or Chocolatey is not available in PATH."
Write-Host "[WARNING] $errorMessage" -ForegroundColor Red -BackgroundColor Black
throw $errorMessage
}
# Disable -y requirement for all packages
choco feature enable -n allowGlobalConfirmation *>$null
# Set the Chocolatey path to the environment variable
$env:PATH += ";C:\ProgramData\chocolatey\bin"
[System.Environment]::SetEnvironmentVariable('Path', $env:Path + ';C:\ProgramData\chocolatey\bin', [System.EnvironmentVariableTarget]::Machine)
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
else {
$env:PATH += ";C:\ProgramData\chocolatey\bin"
[System.Environment]::SetEnvironmentVariable('Path', $env:Path + ';C:\ProgramData\chocolatey\bin', [System.EnvironmentVariableTarget]::Machine)
}
}
chocoinstall
$checkJsonUrl = "https://raw.githubusercontent.com/caglaryalcin/after-format/main/files/apps/check.json"
$jsonContent = Invoke-RestMethod -Uri $checkJsonUrl
$packagesToCheck = $jsonContent.Sources.Packages
$chocoAppsConfigUrl = "https://raw.githubusercontent.com/caglaryalcin/after-format/main/files/apps/choco-apps.config"
[xml]$chocoConfig = Invoke-RestMethod -Uri $chocoAppsConfigUrl
foreach ($pkg in $packagesToCheck) {
$isInstalled = $false
foreach ($identifier in $pkg.PackageIdentifier) {
if (Get-InstalledProgram -programName $identifier) {
$isInstalled = $true
break
}
}
if (-not $isInstalled) {
foreach ($identifier in $pkg.PackageIdentifier) {
$chocoPackageId = $chocoConfig.packages.package | Where-Object { $_.id -match $identifier } | Select-Object -ExpandProperty id
if ($chocoPackageId) {
Write-Host "$identifier" -ForegroundColor Red -BackgroundColor Black -NoNewline
Write-Host " not installed" -NoNewline
Write-Host " with winget." -NoNewline
Write-Host "Trying with" -NoNewLine
Write-Host " chocolatey..." -Foregroundcolor Yellow -NoNewline
$result = choco install $chocoPackageId --ignore-checksums --force -y -Verbose -Timeout 0 2>&1 | Out-String
if ($result -match "was successful*") {
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
break
}
else {
Write-Host "[WARNING]" -ForegroundColor Red -BackgroundColor Black
$logFile = "C:\packages-logs\${identifier}_choco_install.log"
$result | Out-File -FilePath $logFile -Force
Write-Host "[Check the log file at $logFile for details.]"
}
}
else {
##
}
}
}
}
Write-Host @"
----------------
"@ -ForegroundColor Yellow
Function SafeTaskKill {
param($processName)
taskkill /f /im $processName *>$null
if ($LASTEXITCODE -ne 0 -and $LASTEXITCODE -ne 128) {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
SafeTaskKill "GithubDesktop.exe"
SafeTaskKill "Cloudflare WARP.exe"
SafeTaskKill "steam.exe"
SafeTaskKill "AnyDesk.exe"
Function Install-VSCodeExtensions {
Write-Host "Installing Microsoft Visual Studio Code Extensions..." -NoNewline
Start-Sleep 5
$vsCodePath = "$env:USERPROFILE\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" # for winget installations
if (-not (Test-Path "$env:USERPROFILE\AppData\Local\Programs\Microsoft VS Code")) {
$vsCodePath = "C:\Program Files\Microsoft VS Code\bin\code.cmd" # for chocolatey installations
}
$docker = "eamodio.gitlens", "davidanson.vscode-markdownlint", "ms-azuretools.vscode-docker", "formulahendry.docker-explorer", "p1c2u.docker-compose", "ms-vscode-remote.remote-containers"
$autocomplete = "formulahendry.auto-close-tag", "formulahendry.auto-rename-tag", "formulahendry.auto-complete-tag", "streetsidesoftware.code-spell-checker",
"redhat.vscode-xml", "dotjoshjohnson.xml"
$design = "pkief.material-icon-theme"
$vspowershell = "ms-vscode.powershell", "tobysmith568.run-in-powershell", "ms-vscode-remote.remote-wsl"
$frontend = "emin.vscode-react-native-kit", "msjsdiag.vscode-react-native", "pranaygp.vscode-css-peek", "rodrigovallades.es7-react-js-snippets",
"dsznajder.es7-react-js-snippets", "dbaeumer.vscode-eslint", "christian-kohler.path-intellisense", "esbenp.prettier-vscode", "ms-python.python",
"naumovs.color-highlight", "meezilla.json", "oliversturm.fix-json"
$github = "github.vscode-pull-request-github", "github.copilot"
$linux = "rogalmic.bash-debug", "shakram02.bash-beautify", "mads-hartmann.bash-ide-vscode", "redhat.vscode-yaml"
$vsextensions = $docker + $autocomplete + $design + $vspowershell + $frontend + $github + $linux
$installed = & $vsCodePath --list-extensions
foreach ($vse in $vsextensions) {
if ($installed -contains $vse) {
Write-Host "$vse already installed." -ForegroundColor Gray
}
else {
& $vsCodePath --install-extension $vse *>$null
Start-Sleep -Seconds 3 # Give some time for the extension to install
$updatedInstalled = & $vsCodePath --list-extensions
}
}
$allExtensionsInstalled = $True
foreach ($vse in $vsextensions) {
if (-not ($updatedInstalled -contains $vse)) {
$allExtensionsInstalled = $False
break
}
}
if ($allExtensionsInstalled) {
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
else {
Write-Host "[INFO] VSCode's $vse plugin failed to install" -ForegroundColor Yellow -BackgroundColor Black
}
}
Install-VSCodeExtensions
# Visual Studio Code json path
$settingsPath = "$env:USERPROFILE\AppData\Roaming\Code\User\settings.json"
# Get json content
$jsonContent = @"
{
"workbench.colorTheme": "Visual Studio Dark",
"workbench.iconTheme": "material-icon-theme"
}
"@
# Create or rewrite json file
Set-Content -Path $settingsPath -Value $jsonContent -Force
# 7-Zip on PS
try {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force *>$null
Set-PSRepository -Name 'PSGallery' -SourceLocation "https://www.powershellgallery.com/api/v2" -InstallationPolicy Trusted *>$null
Install-Module -Name 7Zip4PowerShell -Force *>$null
if (-Not (Get-Module -ListAvailable -Name 7Zip4PowerShell)) { throw "7Zip4PowerShell module not installed" }
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
# Malwarebytes trial reset
Function MalwarebytesReset {
Write-Host "Adding task for Malwarebytes trial version reset..." -NoNewline
$taskName = "Malwarebytes-Reset"
$taskPath = "\"
$taskDescription = "A task that resets the Malwarebytes Premium trial by changing the MachineGuid registry value"
$currentTime = (Get-Date).ToString("HH:mm")
$currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$powerShellScript = {
New-Guid | ForEach-Object {
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Cryptography' -Name 'MachineGuid' -Value $_.Guid
}
}
$taskAction = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-Command $powerShellScript"
$taskTrigger = New-ScheduledTaskTrigger -Daily -DaysInterval 13 -At $currentTime
$taskSettings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -Hidden
$taskprincipal = New-ScheduledTaskPrincipal -UserId $currentUser -RunLevel Highest
$task = New-ScheduledTask -Action $taskAction -Principal $taskPrincipal -Trigger $taskTrigger -Settings $taskSettings -Description $taskDescription
$result = Register-ScheduledTask -TaskName $taskName -TaskPath $taskPath -InputObject $task
if ($result) {
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
else {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
MalwarebytesReset
# webview2 is being forcibly reloaded because it is necessary
try {
Write-Host "Reinstalling Microsoft Edge WebView2 Runtime..." -NoNewline
Silent
winget install Microsoft.EdgeWebView2Runtime -e --silent --accept-source-agreements --accept-package-agreements --force *>$null
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
##########
#region Remove Unused Apps/Softwares
##########
Function UnusedApps {
# Remove temp softwares task
$taskName = "softwares"
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false
Write-Host `n"---------Remove Unused Apps/Softwares" -ForegroundColor Blue -BackgroundColor Gray
Write-Host `n"Do you want " -NoNewline
Write-Host "Uninstall Unused Apps & Softwares?" -ForegroundColor Yellow -NoNewline
Write-Host "(y/n): " -ForegroundColor Green -NoNewline
$response = Read-Host
if ($response -eq 'y' -or $response -eq 'Y') {
# Remove Apps
Function UninstallThirdPartyBloat {
Write-Host "Uninstalling Default Third Party Applications..." -NoNewline
$UninstallAppxPackages =
"Microsoft.WindowsAlarms", #Alarm and clock app for Windows.
"Microsoft.549981C3F5F10", #Code likely represents a specific app or service, specifics unknown without context.
"Microsoft.WindowsFeedbackHub", #Platform for user feedback on Windows.
"Microsoft.Bing*", #Bing search engine related services and apps.
"Microsoft.Zune*", #Media software for music and videos, now discontinued.
"Microsoft.PowerAutomateDesktop", #Automation tool for desktop workflows.
"Microsoft.WindowsSoundRecorder", #Audio recording app for Windows.
"Microsoft.MicrosoftSolitaireCollection", #Solitaire game collection.
"Microsoft.GamingApp", #Likely related to Xbox or Windows gaming services.
"*microsoft.windowscomm**", #Likely refers to communication services in Windows, specifics unclear.
"MicrosoftCorporationII.QuickAssist", #Remote assistance app by Microsoft.
"Microsoft.Todos", #Task management app.
"Microsoft.SkypeApp", #Skype communication app for Windows.
"Microsoft.Microsoft3DViewer", #App for viewing 3D models.
"Microsoft.Wallet", #Digital wallet app, now discontinued.
"Microsoft.WebMediaExtensions", #Extensions for media formats in web browsers.
"MicrosoftWindows.Client.WebExperience", #Likely related to the web browsing experience in Windows, specifics unclear.
"Clipchamp.Clipchamp", #Video editing app.
"Microsoft.WindowsMaps", #Mapping and navigation app.
"Microsoft.Advertising.Xaml", #Advertising SDK for apps.
"Microsoft.MixedReality.Portal", #Mixed Reality portal app for immersive experiences.
"Microsoft.BingNews", #News aggregation app.
"Microsoft.GetHelp", #Support and troubleshooting app.
"Microsoft.Getstarted", #Introduction and tips app for Windows features.
"Microsoft.MicrosoftOfficeHub", #Central hub for Office apps and services.
"Microsoft.OneConnect", #Connectivity and cloud services app.
"Microsoft.People", #Contact management and social integration app.
"Microsoft.Xbox.TCUI", #Xbox text, chat, and user interface services.
"Microsoft.XboxApp", #Main app for Xbox social and gaming features.
"Microsoft.XboxGameOverlay", #In-game overlay for Xbox features and social interactions.
"Microsoft.XboxIdentityProvider", #Service for Xbox account authentication.
"Microsoft.XboxSpeechToTextOverlay" #Speech-to-text services for Xbox gaming.
$installedApps = Get-AppxPackage -AllUsers
Silent #silently
foreach ($package in $UninstallAppxPackages) {
$app = $installedApps | Where-Object { $_.Name -like $package }
if ($null -ne $app) {
try {
$app | Remove-AppxPackage -ErrorAction Stop
}
catch {
Write-Host "[WARNING] $($_.Exception.Message)" -ForegroundColor Red -BackgroundColor Black
}
}
}
# Uninstall Microsoft Teams Outlook Add-in
$TeamsAddinGUID = '{A7AB73A3-CB10-4AA5-9D38-6AEFFBDE4C91}'
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$TeamsAddinGUID"
if (Test-Path $registryPath) {
try {
Start-Process msiexec.exe -ArgumentList "/x $TeamsAddinGUID /qn /norestart" -NoNewWindow -Wait
}
catch {
Write-Host "[WARNING] $($_.Exception.Message)" -ForegroundColor Red -BackgroundColor Black
}
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
UninstallThirdPartyBloat
# Uninstall Windows Media Player
Function UninstallMediaPlayer {
Write-Host `n"Uninstalling Windows Media Player..." -NoNewline
try {
Silent #silently
Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -eq "WindowsMediaPlayer" } | Disable-WindowsOptionalFeature -Online -NoRestart -WarningAction SilentlyContinue | Out-Null
Get-WindowsCapability -Online | Where-Object { $_.Name -like "Media.WindowsMediaPlayer*" } | Remove-WindowsCapability -Online | Out-Null
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
UninstallMediaPlayer
# Uninstall Work Folders Client - Not applicable to Server
Function UninstallWorkFolders {
Write-Host "Uninstalling Work Folders Client..." -NoNewline
try {
Silent #silently
Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -eq "WorkFolders-Client" } | Disable-WindowsOptionalFeature -Online -NoRestart -WarningAction SilentlyContinue | Out-Null
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
UninstallWorkFolders
# Uninstall Microsoft XPS Document Writer
Function UninstallXPSPrinter {
Write-Host "Uninstalling Microsoft XPS Document Writer..." -NoNewline
try {
Remove-Printer -Name "Microsoft XPS Document Writer" -ErrorAction SilentlyContinue
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
UninstallXPSPrinter
# Remove Default Fax Printer
Function RemoveFaxPrinter {
Write-Host "Removing Default Fax Printer..." -NoNewline
try {
Remove-Printer -Name "Fax" -ErrorAction SilentlyContinue
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
RemoveFaxPrinter
# Uninstall Windows Fax and Scan Services - Not applicable to Server
Function UninstallFaxAndScan {
Write-Host "Uninstalling Windows Fax and Scan Services..." -NoNewline
try {
Silent #silently
Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -eq "FaxServicesClientPackage" } | Disable-WindowsOptionalFeature -Online -NoRestart -WarningAction SilentlyContinue | Out-Null
Get-WindowsCapability -Online | Where-Object { $_.Name -like "Print.Fax.Scan*" } | Remove-WindowsCapability -Online | Out-Null
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
UninstallFaxAndScan
# Delete some folders from This PC
Function UnpinExplorer {
Write-Host "Deleting 3D Folders, Pictures, Videos, Music from This PC..." -NoNewline
$basePath = "HKLM:\SOFTWARE"
$wow6432Node = "Wow6432Node\"
$explorerPath = "Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\"
$quickAccessPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HomeFolderMSGraph\NameSpace\DelegateFolders\{3936E9E4-D92C-4EEE-A85A-BC16D5EA0819}"
$homePath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace_36354489\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}"
$namespaces = @{
"3DFolders" = "{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
"Videos" = "{A0953C92-50DC-43bf-BE83-3742FED03C9C}", "{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}"
"Pictures" = "{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}", "{24ad3ad4-a569-4530-98e1-ab02f9417aa8}"
}
foreach ($category in $namespaces.Keys) {
foreach ($id in $namespaces[$category]) {
$paths = @(
"$basePath\$explorerPath$id",
"$basePath\$wow6432Node$explorerPath$id"
)
foreach ($path in $paths) {
try {
Remove-Item -Path $path -Recurse -ErrorAction SilentlyContinue
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
}
}
# Additional paths
try {
Remove-Item -Path $quickAccessPath -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $homePath -Recurse -ErrorAction SilentlyContinue
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
UnpinExplorer
# Block Microsoft Edge telemetry
Function EdgePrivacySettings {
Write-Host "Adjusting Microsoft Edge privacy settings..." -NoNewline
$EdgePrivacyCUPath = "HKCU:\Software\Policies\Microsoft\Edge"
$EdgePrivacyAUPath = "HKLM:\SOFTWARE\Policies\Microsoft\Edge"
$EdgePrivacyKeys = @(
"PaymentMethodQueryEnabled",
"PersonalizationReportingEnabled",
"AddressBarMicrosoftSearchInBingProviderEnabled",
"UserFeedbackAllowed",
"AutofillCreditCardEnabled",
"AutofillAddressEnabled",
"LocalProvidersEnabled",
"SearchSuggestEnabled",
"EdgeShoppingAssistantEnabled",
"WebWidgetAllowed",
"HubsSidebarEnabled"
)
$EdgePrivacyKeys | ForEach-Object {
if (-not (Test-Path $EdgePrivacyCUPath)) {
New-Item -Path $EdgePrivacyCUPath -Force *>$null
}
try {
Set-ItemProperty -Path $EdgePrivacyCUPath -Name $_ -Value 0
Set-ItemProperty -Path $EdgePrivacyCUPath -Name "ConfigureDoNotTrack" -Value 1
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
$EdgePrivacyAUKeys = @(
"DoNotTrack",
"QuicAllowed",
"SearchSuggestEnabled",
"AllowSearchAssistant",
"FormFillEnabled",
"PaymentMethodQueryEnabled",
"PersonalizationReportingEnabled",
"AddressBarMicrosoftSearchInBingProviderEnabled",
"UserFeedbackAllowed",
"AutofillCreditCardEnabled",
"AutofillAddressEnabled",
"LocalProvidersEnabled",
"SearchSuggestEnabled",
"EdgeShoppingAssistantEnabled",
"WebWidgetAllowed",
"HubsSidebarEnabled"
)
$EdgePrivacyAUKeys | ForEach-Object {
if (-not (Test-Path $EdgePrivacyAUPath)) {
New-Item -Path $EdgePrivacyAUPath -Force *>$null
}
try {
Set-ItemProperty -Path $EdgePrivacyAUPath -Name $_ -Value 0
Set-ItemProperty -Path $EdgePrivacyAUPath -Name "ConfigureDoNotTrack" -Value 1
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
EdgePrivacySettings
Function OfficePrivacySettings {
Write-Host "Adjusting Microsoft Office privacy settings..." -NoNewline
$OfficePrivacyRegistryKeys = @{
"HKCU:\Software\Microsoft\Office\Common\ClientTelemetry" = @{
"DisableTelemetry" = 1
}
"HKCU:\Software\Policies\Microsoft\Office\Common\ClientTelemetry" = @{
"SendTelemetry" = 3
}
"HKCU:\Software\Policies\Microsoft\Office\16.0\Common" = @{
"QMEnable" = 0;
"LinkedIn" = 0
}
"HKCU:\Software\Microsoft\Office\16.0\Common\MailSettings" = @{
"InlineTextPrediction" = 0
}
"HKCU:\Software\Policies\Microsoft\Office\16.0\osm" = @{
"Enablelogging" = 0;
"EnableUpload" = 0;
"EnableFileObfuscation" = 1
}
"HKCU:\Software\Policies\Microsoft\Office\16.0\Common\Feedback" = @{
"SurveyEnabled" = 0;
"Enabled" = 0;
"IncludeEmail" = 0
}
}
foreach ($key in $OfficePrivacyRegistryKeys.GetEnumerator()) {
$registryPath = $key.Key
$registryValues = $key.Value
if (-not (Test-Path $registryPath)) {
New-Item -Path $registryPath -Force *>$null
}
foreach ($valueName in $registryValues.GetEnumerator()) {
$value = $valueName.Key
$data = $valueName.Value
try {
Set-ItemProperty -Path $registryPath -Name $value -Value $data
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
OfficePrivacySettings
Function DisableWindowsSync {
Write-Host "Disabling Windows Sync..." -NoNewline
$WindowsSyncRegistryKeys = @{
"HKCU:\Software\Microsoft\Windows\CurrentVersion\SettingSync" = @{
"SyncPolicy" = 5
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Personalization" = @{
"Enabled" = 0
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\BrowserSettings" = @{
"Enabled" = 0
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Credentials" = @{
"Enabled" = 0
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language" = @{
"Enabled" = 0
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Accessibility" = @{
"Enabled" = 0
}
"HKCU:\Software\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Windows" = @{
"Enabled" = 0
}
}
foreach ($key in $WindowsSyncRegistryKeys.GetEnumerator()) {
$registryPath = $key.Key
$registryValues = $key.Value
if (-not (Test-Path $registryPath)) {
New-Item -Path $registryPath -Force *>$null
}
foreach ($valueName in $registryValues.GetEnumerator()) {
$value = $valueName.Key
$data = $valueName.Value
try {
Set-ItemProperty -Path $registryPath -Name $value -Value $data
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
}
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
DisableWindowsSync
# The function is here because programs add themselves to the right click menu after loading
Function RightClickMenu {
try {
Write-Host "Editing the right click menu..." -NoNewline
# New PS Drives
New-PSDrive -Name "HKCR" -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" | Out-Null
# Old right click menu
$regPath = "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32"
reg.exe add $regPath /f /ve *>$null
$contextMenuPaths = @(
"HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\SendTo", #remove send to
"HKEY_CLASSES_ROOT\UserLibraryFolder\shellex\ContextMenuHandlers\SendTo", #remove send to
"HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\ModernSharing", #remove share
"HKEY_CLASSES_ROOT\*\shell\pintohomefile", #remove favorites
#remove give access
"HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Sharing",
"HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\Sharing",
"HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\Sharing",
"HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\Sharing",
"HKEY_CLASSES_ROOT\LibraryFolder\background\shellex\ContextMenuHandlers\Sharing",
"HKEY_CLASSES_ROOT\UserLibraryFolder\shellex\ContextMenuHandlers\Sharing",
#remove previous
"HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}",
"HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}",
"HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}",
"HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}",
#remove "Include in library"
"HKEY_CLASSES_ROOT\Folder\ShellEx\ContextMenuHandlers\Library Location",
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\ShellEx\ContextMenuHandlers\Library Location"
#remove "copy as path"
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers\CopyAsPathMenu"
#remove git
"HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui",
"HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell",
#remove treesize
"HKEY_CLASSES_ROOT\Directory\Background\shell\TreeSize Free",
"HKEY_CLASSES_ROOT\Directory\Background\shell\VSCode"
#remove mpc player
"HKEY_CLASSES_ROOT\Directory\shell\mplayerc64.enqueue"
#remove sharex
"HKEY_CLASSES_ROOT\Directory\shell\ShareX"
#remove vlc
"HKEY_CLASSES_ROOT\Directory\shell\AddToPlaylistVLC"
#remove google drive
"HKEY_CLASSES_ROOT\GoogleDriveFS.gcsedoc"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gcsesheet"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gcseslides"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gdoc"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gdraw"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gdrive"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gform"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gjam"
"HKEY_CLASSES_ROOT\GoogleDriveFS.glink"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gmaillayout"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gmap"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gnote"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gscript"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gsheet"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gsite"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gslides"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gtable"
"HKEY_CLASSES_ROOT\GoogleDriveFS.gvid"
)
foreach ($path in $contextMenuPaths) {
$regPath = $path -replace 'HKCR:\\', 'HKEY_CLASSES_ROOT\'
$cmd = "reg delete `"$regPath`" /f"
Invoke-Expression $cmd *>$null
}
# New hash menu for right click
$regpath = "HKEY_CLASSES_ROOT\*\shell\hash"
$sha256menu = "HKEY_CLASSES_ROOT\*\shell\hash\shell\02menu"
$md5menu = "HKEY_CLASSES_ROOT\*\shell\hash\shell\03menu"
reg add $regpath /f *>$null
reg add $regpath /v "MUIVerb" /t REG_SZ /d HASH /f *>$null
reg add $regpath /v "SubCommands" /t REG_SZ /d """" /f *>$null
reg add "$regpath\shell" /f *>$null
reg add "$sha256menu" /f *>$null
reg add "$sha256menu\command" /f *>$null
reg add "$sha256menu" /v "MUIVerb" /t REG_SZ /d SHA256 /f *>$null
$tempOut = [System.IO.Path]::GetTempFileName()
$tempErr = [System.IO.Path]::GetTempFileName()
Start-Process cmd.exe -ArgumentList '/c', 'reg add "HKEY_CLASSES_ROOT\*\shell\hash\shell\02menu\command" /ve /d "powershell -noexit get-filehash -literalpath \"%1\" -algorithm SHA256 | format-list" /f' -NoNewWindow -RedirectStandardOutput $tempOut -RedirectStandardError $tempErr
Remove-Item $tempOut -ErrorAction Ignore
Remove-Item $tempErr -ErrorAction Ignore
reg add "$md5menu" /f *>$null
reg add "$md5menu\command" /f *>$null
reg add "$md5menu" /v "MUIVerb" /t REG_SZ /d MD5 /f *>$null
$tempOut = [System.IO.Path]::GetTempFileName()
$tempErr = [System.IO.Path]::GetTempFileName()
Start-Process cmd.exe -ArgumentList '/c', 'reg add "HKEY_CLASSES_ROOT\*\shell\hash\shell\03menu\command" /ve /d "powershell -noexit get-filehash -literalpath \"%1\" -algorithm MD5 | format-list" /f' -NoNewWindow -RedirectStandardOutput $tempOut -RedirectStandardError $tempErr
Remove-Item $tempOut -ErrorAction Ignore
Remove-Item $tempErr -ErrorAction Ignore
# Add Turn Off Display Menu
$turnOffDisplay = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\TurnOffDisplay"
reg add $turnOffDisplay /f *>$null
reg add $turnOffDisplay /v "Icon" /t REG_SZ /d "imageres.dll,-109" /f *>$null
reg add $turnOffDisplay /v "MUIVerb" /t REG_SZ /d "Turn off display" /f *>$null
reg add $turnOffDisplay /v "Position" /t REG_SZ /d "Bottom" /f *>$null
reg add $turnOffDisplay /v "SubCommands" /t REG_SZ /d """" /f *>$null
reg add "$turnOffDisplay\shell" /f *>$null
$turnOffMenu1 = "$turnOffDisplay\shell\01menu"
reg add $turnOffMenu1 /f *>$null
reg add $turnOffMenu1 /v "Icon" /t REG_SZ /d "powercpl.dll,-513" /f *>$null
reg add $turnOffMenu1 /v "MUIVerb" /t REG_SZ /d "Turn off display" /f *>$null
reg add "$turnOffMenu1\command" /f *>$null
reg add "$turnOffMenu1\command" /ve /d 'cmd /c "powershell.exe -Command \"(Add-Type ''[DllImport(\\\"user32.dll\\\")]public static extern int SendMessage(int hWnd,int hMsg,int wParam,int lParam);'' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)\""' /f *>$null
$turnOffMenu2 = "$turnOffDisplay\shell\02menu"
reg add $turnOffMenu2 /f *>$null
reg add $turnOffMenu2 /v "MUIVerb" /t REG_SZ /d "Lock computer and Turn off display" /f *>$null
reg add $turnOffMenu2 /v "CommandFlags" /t REG_DWORD /d 0x20 /f *>$null
reg add $turnOffMenu2 /v "Icon" /t REG_SZ /d "imageres.dll,-59" /f *>$null
reg add "$turnOffMenu2\command" /f *>$null
reg add "$turnOffMenu2\command" /ve /d 'cmd /c "powershell.exe -Command \"(Add-Type ''[DllImport(\\\"user32.dll\\\")]public static extern int SendMessage(int hWnd,int hMsg,int wParam,int lParam);'' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)\" & rundll32.exe user32.dll, LockWorkStation"' /f *>$null
# Add "Find Empty Folders"
$command = 'powershell.exe -NoExit -Command "Get-ChildItem -Path ''%V'' -Directory -Recurse | Where-Object { $_.GetFileSystemInfos().Count -eq 0 } | ForEach-Object { $_.FullName }"'
$registryPaths = @(
"Registry::HKEY_CLASSES_ROOT\Directory\shell\FindEmptyFolders",
"Registry::HKEY_CLASSES_ROOT\Directory\shell\FindEmptyFolders\command",
"Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\FindEmptyFolders",
"Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\FindEmptyFolders\command",
"Registry::HKEY_CLASSES_ROOT\Drive\shell\FindEmptyFolders",
"Registry::HKEY_CLASSES_ROOT\Drive\shell\FindEmptyFolders\command"
)
# Create 'Directory\shell\FindEmptyFolders'
New-Item -Path $registryPaths[0] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[0] -Name "(Default)" -Value "Find Empty Folders"
Set-ItemProperty -Path $registryPaths[0] -Name "Icon" -Value "imageres.dll,-1025"
# Create 'Directory\shell\FindEmptyFolders\command'
New-Item -Path $registryPaths[1] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[1] -Name "(Default)" -Value $command
# Create 'Directory\Background\shell\FindEmptyFolders'
New-Item -Path $registryPaths[2] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[2] -Name "(Default)" -Value "Find Empty Folders"
Set-ItemProperty -Path $registryPaths[2] -Name "Icon" -Value "imageres.dll,-1025"
# Create 'Directory\Background\shell\FindEmptyFolders\command'
New-Item -Path $registryPaths[3] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[3] -Name "(Default)" -Value $command
# Create 'Drive\shell\FindEmptyFolders'
New-Item -Path $registryPaths[4] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[4] -Name "(Default)" -Value "Find Empty Folders"
Set-ItemProperty -Path $registryPaths[4] -Name "Icon" -Value "imageres.dll,-1025"
# Create 'Drive\shell\FindEmptyFolders\command'
New-Item -Path $registryPaths[5] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[5] -Name "(Default)" -Value $command
# Restart Windows Explorer
taskkill /f /im explorer.exe *>$null
Start-Sleep 1
Start-Process "explorer.exe" -ErrorAction Stop
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
RightClickMenu
Function DisableWidgets {
Write-Host "Disabling Windows Widgets..." -NoNewline
try {
Get-AppxPackage -AllUsers -Name *WebExperience* | Remove-AppxPackage -AllUsers *>$null
Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}
catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
}
DisableWidgets
# Remove Tasks in Task Scheduler
Function RemoveTasks {
$description = @"
+---------------------------------------------+
| If you apply it, |
| it turns off windows automatic updates, |
| you can only update manually. |
+---------------------------------------------+
"@
Write-Host `n$description -ForegroundColor Yellow
Write-Host `n"Do you want " -NoNewline
Write-Host "apps and Windows update tasks to be deleted?" -ForegroundColor Yellow -NoNewline
Write-Host "(y/n): " -ForegroundColor Green -NoNewline
$response = Read-Host
if ($response -eq 'y' -or $response -eq 'Y') {
Write-Host "Removing Unnecessary Tasks..." -NoNewline
$taskPatterns = @("OneDrive*", "MicrosoftEdge*", "Google*", "Brave*", "Intel*", "klcp*", "MSI*",
"*Adobe*", "CCleaner*", "G2M*", "Opera*", "Overwolf*", "User*", "CreateExplorer*", "{*", "*Samsung*", "*npcap*",
"*Consolidator*", "*Dropbox*", "*Heimdal*", "*klcp*", "*UsbCeip*", "*DmClient*", "*Office Auto*", "*Office Feature*",
"*OfficeTelemetry*", "*GPU*", "Xbl*", "Firefox Back*")
$windowsUpdateTasks = @(
"\Microsoft\Windows\WindowsUpdate\Scheduled Start",
"\Microsoft\Windows\UpdateOrchestrator\Schedule Scan",
"\Microsoft\Windows\UpdateOrchestrator\Schedule Scan Static Task",
"\Microsoft\Windows\UpdateOrchestrator\Schedule Work",
"\Microsoft\Windows\UpdateOrchestrator\Report policies",
"\Microsoft\Windows\UpdateOrchestrator\UpdateModelTask",