Advertisement
Nelka

Debloating of your Windows 10 or 11

Feb 22nd, 2023 (edited)
937
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 4.02 KB | Software | 0 0
  1. # This can helps you debloaat windows 11.
  2. # SAVE IS AS debload.ps1 on your computer
  3. # You must run PowerShell in Administrator rights and type C:\Type\where\you\saved\your\script\debloat.ps1 and hit enter.
  4. # Script should automatically run.
  5. # If you wan keep some Windows Provisioned Apps, just comment as you can see commented my dropbox
  6. # For example want keep Xbox apps or BingWeather.
  7. # Any tips for help are welcome. Also, if you wee error in script, please don't hestitate contact me. Thanks
  8.  
  9. # Changelog
  10. # 1.1 Added disabling tracking you by Windows
  11.  
  12. # Questions
  13. # It's better using HKLM or HKCU in regedit? HKLM should be for all system but HKCU has higher priority, right?
  14.  
  15. $ErrorActionPreference = "SilentlyContinue"
  16. Set-ExecutionPolicy Unrestricted
  17.  
  18. function ConcatPath($pathArray) {
  19.   $pathResult = ""
  20.   foreach($pathPartial in $pathArray) {
  21.     if ($pathResult -eq "") { $pathResult = $pathArray[0] }
  22.     else { $pathResult += '\' + $pathPartial }
  23.   }
  24.   return $pathResult
  25. }
  26.  
  27.  
  28. $ArrayWhatMicrosoftSeeOnYourSystem = @(
  29.   #Disabling Lockscreen when you're login
  30.   @("HKLM:\Software\Policies\Microsoft\Windows", "Personalization", "Nolockscreen", "DWord", "1"),
  31.   #Disable Cortana
  32.   @("HKLM:\Software\Policies\Microsoft\Windows", "Windows Search", "AllowCortana", "DWord", "0"),
  33.   #Disable Advertising ID
  34.   @("HKLM:\Software\Microsoft\Windows\CurrentVersion", "AdvertisingInfo", "Enabled", "DWord", "0"),
  35.   #Disable Telemetry
  36.   @("HKLM:\Software\Policies\Microsoft\Windows", "DataCollection", "AllowTelemetry", "DWord", "0"),
  37.   #Disable Suggested cotent
  38.   @("HKLM:\Software\Microsoft\Windows\CurrentVersion", "ContentDeliveryManager", "SubscribedContent-338393Enabled", "DWord", "0"),
  39.   @("HKLM:\Software\Microsoft\Windows\CurrentVersion", "ContentDeliveryManager", "SubscribedContent-338393Enabled", "DWord", "0"),
  40.   @("HKLM:\Software\Microsoft\Windows\CurrentVersion", "ContentDeliveryManager", "SubscribedContent-338393Enabled", "DWord", "0"),
  41.   #Disable Windows improve Start and search results by tracking app launches
  42.   @("HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer", "Advanced", "Start_TrackProgs", "DWord", "0"),
  43.   #Disable Let website show me locally relevant content by accessing my language list
  44.   @("HKLM:\Control Panel\International", "User Profile", "HttpAcceptLanguageOptOut", "DWord", "0")
  45.  
  46. )
  47.  
  48. foreach($item in $ArrayWhatMicrosoftSeeOnYourSystem) {
  49.   try {
  50.     New-Item -Path $item[0] -Name $item[1] -Force | Out-Null
  51.     New-ItemProperty -Path (ConcatPath($item[0],$item[1])) -Name $item[2] -PropertyType $item[3] -Value $item[4] -Force | Out-Null
  52.   } catch {
  53.     Write-Host("Something Wrong $_")
  54.   }
  55. }
  56.  
  57. $packagesToRemove = @(
  58.     "Microsoft.XboxApp",
  59.     "Microsoft.XboxGameCallableUI",
  60.     "Microsoft.XboxGameOverlay",
  61.     "Microsoft.XboxIdentityProvider",
  62.     "Microsoft.XboxSpeechToTextOverlay"
  63. #    "DropboxInc.Dropbox",
  64.     "Microsoft.BingNews",
  65.     "Microsoft.ZuneMusic",
  66.     "Microsoft.ZuneVideo",
  67. #    "Microsoft.Office.OneNote",
  68.     "Microsoft.MicrosoftStickyNotes",
  69.     "Microsoft.YourPhone",
  70.     "Microsoft.Todos",
  71.     "Microsoft.WindowsMaps",
  72. #    "Microsoft.WindowsSoundRecorder",
  73.     "Microsoft.WindowsStore",
  74. #    "Microsoft.PowerAutomateDesktop",
  75.     "Microsoft.MicrosoftOfficeHub",
  76.     "Microsoft.MicrosoftSolitaireCollection",
  77. #    "Microsoft.GamingApp",
  78.     "Microsoft.BingWeather"
  79. )
  80.  
  81. $provisionedPackages = @(DISM /Online /Get-ProvisionedAppxPackages | select-string PackageName)
  82.  
  83. foreach ($provisionedPackage in $ProvisionedPackages) {
  84.   foreach ($packageToRemove in $packagesToRemove) {
  85.         if($provisionedPackage -match $packageToRemove) {
  86.           try {
  87.            $provisionedPackage = $provisionedPackage -replace('^PackageName\s?:\s?(.*)', '$1')
  88.            Remove-ProvisionedAppxPackage -AllUsers -Online -PackageName $provisionedPackage
  89.            Write-Host("$provisionedPackage was removed!")
  90.           } catch {
  91.            Write-Output "Something threw an exception or used Write-Error"
  92.            Write-Output $_
  93.           }
  94.         }
  95.   }
  96. }
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement