mayankjoin3

win10 11 debloat part 2.ps1

Nov 10th, 2025 (edited)
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#
  2. .SYNOPSIS
  3.   Unified Windows 10/11 Debloater (safe)
  4.   - Removes selected bloat per OS (Win10 & Win11 aware)
  5.   - Keeps user apps & Microsoft Store stack
  6.   - Trims telemetry/ads/scheduled tasks (reversible)
  7.   Run as Administrator.
  8.  
  9.   Edit the two sections below if you want to keep/remove more.
  10. #>
  11.  
  12. # =========================
  13. # 0) PREP & ADMIN CHECK
  14. # =========================
  15. if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()
  16.   ).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
  17.   Write-Host "Please run this script as Administrator!" -ForegroundColor Red
  18.   exit 1
  19. }
  20.  
  21. $ErrorActionPreference = 'SilentlyContinue'
  22. $ProgressPreference    = 'SilentlyContinue'
  23.  
  24. # Detect OS (Win10 vs Win11) using build number
  25. $build = [Environment]::OSVersion.Version.Build
  26. $IsWin11 = ($build -ge 22000)
  27. $OsName  = if ($IsWin11) { 'Windows 11' } else { 'Windows 10' }
  28.  
  29. Write-Host "`n== Unified Debloater ($OsName) ==" -ForegroundColor Cyan
  30.  
  31. # =========================
  32. # 1) KEEP LIST (DO-NOT-TOUCH)
  33. # =========================
  34. # Your installed apps + essentials
  35. $KeepNames = @(
  36.   # Your user apps (from your dump)
  37.   '5319275A.WhatsAppDesktop',  # WhatsApp Desktop
  38.   'DropboxInc.Dropbox',        # Dropbox
  39.   'NotepadPlusPlus',           # Notepad++
  40.   'WinMerge',                  # WinMerge
  41.   'WinRAR.ShellExtension',     # WinRAR Shell Extension
  42.   '53621FSApps.FluentTerminal',# Fluent Terminal
  43.  
  44.   # Dev tools you said to keep
  45.   'MicrosoftCorporationII.WindowsSubsystemForLinux', # WSL
  46.   'Microsoft.WindowsTerminal',                       # Windows Terminal
  47.  
  48.   # Store / winget stack (keep to avoid breaking Store & installers)
  49.   'Microsoft.WindowsStore',
  50.   'Microsoft.StorePurchaseApp',
  51.   'Microsoft.DesktopAppInstaller',
  52.   'Microsoft.Winget.Source'
  53. )
  54.  
  55. function Test-IsKept([string]$name) { return $KeepNames -contains $name }
  56.  
  57. # =========================
  58. # 2) REMOVAL LISTS
  59. # =========================
  60. # 2a) Shared bloat (Win10 & Win11) — safe to remove
  61. $CommonRemove = @(
  62.   # Xbox surface (if you don't game)
  63.   'Microsoft.Xbox.TCUI',
  64.   'Microsoft.XboxIdentityProvider',
  65.   'Microsoft.XboxSpeechToTextOverlay',
  66.   'Microsoft.XboxGameCallableUI',
  67.  
  68.   # Microsoft promos/assistants
  69.   'Microsoft.GetHelp',
  70.   'Microsoft.M365Companions',
  71.   'Microsoft.Edge.GameAssist',
  72.  
  73.   # Consumer media app (remove if unused)
  74.   'Microsoft.ZuneMusic'
  75. )
  76.  
  77. # 2b) Win11-only adds
  78. $Win11Only = @(
  79.   # Widgets / Web Experience / Copilot surface
  80.   'MicrosoftWindows.Client.WebExperience',
  81.  
  82.   # OEM / GPU control panels (drivers remain)
  83.   'AD2F1837.HPAudioCenter',
  84.   'AppUp.IntelGraphicsExperience',
  85.   'AdvancedMicroDevicesInc-2.AMDRadeonSoftware'
  86. )
  87.  
  88. # 2c) Win10-only classics (safe to remove if present)
  89. $Win10Only = @(
  90.   'Microsoft.3DBuilder',
  91.   'Microsoft.Print3D',
  92.   'Microsoft.Microsoft3DViewer',
  93.   'Microsoft.Getstarted',
  94.   'Microsoft.BingNews',
  95.   'Microsoft.BingWeather',
  96.   'Microsoft.MicrosoftSolitaireCollection',
  97.   'Microsoft.SkypeApp',
  98.   'Microsoft.MinecraftUWP',
  99.   'Microsoft.Whiteboard',
  100.   'Microsoft.WindowsAlarms',
  101.   'Microsoft.WindowsFeedbackHub',
  102.   'Microsoft.WindowsMaps',
  103.   'Microsoft.MixedReality.Portal',
  104.   'Microsoft.XboxApp',
  105.   'Microsoft.XboxGameOverlay',
  106.   'Microsoft.XboxGamingOverlay',
  107.   'Microsoft.People',          # (legacy People app tile)
  108.   'Microsoft.OneConnect',      # (Mobile plans / messaging)
  109.   'Microsoft.Office.OneNote',  # (Store OneNote; O365 OneNote desktop remains)
  110.   'Microsoft.Wallet'
  111.   # NOTE: If you really want to remove Sticky Notes / Paint / Camera / Calculator,
  112.   # add: 'Microsoft.MicrosoftStickyNotes','Microsoft.MSPaint','Microsoft.WindowsCamera','Microsoft.WindowsCalculator'
  113. )
  114.  
  115. # 2d) Cortana (both OSes) – remove app + disable toggle
  116. $CortanaPkgName = 'Microsoft.549981C3F5F10'
  117.  
  118. # Build the final removal list based on OS
  119. $RemoveNames = @()
  120. $RemoveNames += $CommonRemove
  121. if ($IsWin11) { $RemoveNames += $Win11Only } else { $RemoveNames += $Win10Only }
  122. $RemoveNames = $RemoveNames | Where-Object { -not (Test-IsKept $_) } | Select-Object -Unique
  123.  
  124. # =========================
  125. # 3) Removal helper
  126. # =========================
  127. function Remove-AppxEverywhere {
  128.   param([string]$Name)
  129.  
  130.   if (Test-IsKept $Name) {
  131.     Write-Host "SKIP (kept): $Name" -ForegroundColor Yellow
  132.     return
  133.   }
  134.  
  135.   Write-Host "→ $Name" -ForegroundColor Gray
  136.  
  137.   # Current user
  138.   $u = Get-AppxPackage -Name $Name
  139.   if ($u) { $u | Remove-AppxPackage }
  140.  
  141.   # All users
  142.   $a = Get-AppxPackage -AllUsers -Name $Name
  143.   if ($a) { $a | Remove-AppxPackage -AllUsers }
  144.  
  145.   # Deprovision for new users
  146.   $p = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -eq $Name }
  147.   if ($p) {
  148.     $p | ForEach-Object { Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName | Out-Null }
  149.   }
  150. }
  151.  
  152. # =========================
  153. # 4) Remove packages
  154. # =========================
  155. Write-Host "`n-- Removing selected apps for $OsName (skips if missing) --" -ForegroundColor Cyan
  156. $RemoveNames | ForEach-Object { Remove-AppxEverywhere -Name $_ }
  157.  
  158. # Cortana (both)
  159. Write-Host "→ Cortana (app + policy)" -ForegroundColor Gray
  160. Get-AppxPackage -AllUsers | Where-Object { $_.Name -eq $CortanaPkgName } | Remove-AppxPackage
  161. Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -eq $CortanaPkgName } | Remove-AppxProvisionedPackage -Online | Out-Null
  162.  
  163. # Disable Cortana + Bing web search
  164. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v AllowCortana /t REG_DWORD /d 0 /f | Out-Null
  165. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Search" /v BingSearchEnabled /t REG_DWORD /d 0 /f | Out-Null
  166. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Search" /v CortanaConsent /t REG_DWORD /d 0 /f | Out-Null
  167.  
  168. # =========================
  169. # 5) Telemetry / Ads / Suggestions (reversible)
  170. # =========================
  171. Write-Host "`n-- Trimming telemetry & ads --" -ForegroundColor Cyan
  172.  
  173. # Services (safe)
  174. Stop-Service DiagTrack -Force
  175. Set-Service  DiagTrack -StartupType Disabled
  176. Stop-Service dmwappushservice -Force
  177. Set-Service  dmwappushservice -StartupType Disabled
  178.  
  179. # Scheduled tasks (safe to disable)
  180. $tasks = @(
  181.   '\Microsoft\Windows\Application Experience\ProgramDataUpdater',
  182.   '\Microsoft\Windows\Customer Experience Improvement Program\Consolidator',
  183.   '\Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask',
  184.   '\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip',
  185.   '\Microsoft\Windows\Feedback\Siuf\DmClient',
  186.   '\Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload',
  187.   '\Microsoft\Windows\Maps\MapsUpdateTask',
  188.   '\Microsoft\Windows\Windows Error Reporting\QueueReporting'
  189. )
  190. foreach ($t in $tasks) {
  191.   try {
  192.     Disable-ScheduledTask -TaskPath ($t.Substring(0,$t.LastIndexOf('\')+1)) `
  193.                           -TaskName ($t.Split('\')[-1])
  194.   } catch {}
  195. }
  196.  
  197. # Ads/tips/suggestions (per-user)
  198. $cdm = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager'
  199. New-Item -Path $cdm -Force | Out-Null
  200. $flags = @{
  201.   'ContentDeliveryAllowed'           = 0
  202.   'OemPreInstalledAppsEnabled'       = 0
  203.   'PreInstalledAppsEnabled'          = 0
  204.   'PreInstalledAppsEverEnabled'      = 0
  205.   'SilentInstalledAppsEnabled'       = 0
  206.   'SystemPaneSuggestionsEnabled'     = 0
  207.   'SoftLandingEnabled'               = 0
  208.   'SubscribedContent-310093Enabled'  = 0
  209.   'SubscribedContent-338387Enabled'  = 0
  210.   'SubscribedContent-338388Enabled'  = 0
  211.   'SubscribedContent-338389Enabled'  = 0
  212.   'SubscribedContent-353694Enabled'  = 0
  213.   'SubscribedContent-353696Enabled'  = 0
  214. }
  215. foreach ($k in $flags.Keys) { Set-ItemProperty -Path $cdm -Name $k -Value $flags[$k] -Type DWord -Force }
  216.  
  217. # Explorer & Settings suggestions (per-user)
  218. New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Force | Out-Null
  219. Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'ShowSyncProviderNotifications' -Value 0 -Type DWord -Force
  220. New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\Accounts' -Force | Out-Null
  221. Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\Accounts' -Name 'EnablePromotionalFeatures' -Value 0 -Type DWord -Force
  222.  
  223. # =========================
  224. # A) Helper: detect NonRemovable packages and skip removal
  225. # =========================
  226. function Remove-AppxEverywhere {
  227.   param([string]$Name)
  228.  
  229.   if (Test-IsKept $Name) {
  230.     Write-Host "SKIP (kept): $Name" -ForegroundColor Yellow
  231.     return
  232.   }
  233.  
  234.   # If any installed instance is marked NonRemovable, skip uninstall and fall back to "disable" path.
  235.   $any = @(Get-AppxPackage -AllUsers -Name $Name)
  236.   $isNonRemovable = $false
  237.   if ($any.Count -gt 0) {
  238.     # Query the first instance for NonRemovable; if true, treat as non-removable.
  239.     $isNonRemovable = ($any | Where-Object { $_.NonRemovable -eq $true }).Count -gt 0
  240.   }
  241.  
  242.   if ($isNonRemovable) {
  243.     Write-Host "→ $Name is NonRemovable (system app). Skipping uninstall and applying disable tweaks." -ForegroundColor Yellow
  244.     if ($Name -eq 'Microsoft.XboxGameCallableUI') {
  245.       Disable-XboxOverlay
  246.     }
  247.     return
  248.   }
  249.  
  250.   Write-Host "→ $Name" -ForegroundColor Gray
  251.  
  252.   # Current user
  253.   $u = Get-AppxPackage -Name $Name
  254.   if ($u) { $u | Remove-AppxPackage }
  255.  
  256.   # All users
  257.   $a = Get-AppxPackage -AllUsers -Name $Name
  258.   if ($a) { $a | Remove-AppxPackage -AllUsers }
  259.  
  260.   # Deprovision for new users
  261.   $p = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -eq $Name }
  262.   if ($p) {
  263.     $p | ForEach-Object { Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName | Out-Null }
  264.   }
  265. }
  266.  
  267. # =========================
  268. # B) Disable function: Xbox Game Bar / overlay / DVR / services
  269. # =========================
  270. function Disable-XboxOverlay {
  271.   Write-Host "   - Disabling Xbox Game Bar / Game DVR / services" -ForegroundColor Gray
  272.  
  273.   # Policy: disable Game DVR system-wide
  274.   reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\GameDVR" /v AllowGameDVR /t REG_DWORD /d 0 /f | Out-Null
  275.  
  276.   # Per-user switches
  277.   reg add "HKCU\SOFTWARE\Microsoft\GameBar" /v ShowStartupPanel /t REG_DWORD /d 0 /f | Out-Null
  278.   reg add "HKCU\SOFTWARE\Microsoft\GameBar" /v UseNexusForGameBarEnabled /t REG_DWORD /d 0 /f | Out-Null
  279.   reg add "HKCU\System\GameConfigStore" /v GameDVR_Enabled /t REG_DWORD /d 0 /f | Out-Null
  280.   reg add "HKCU\System\GameConfigStore" /v GameDVR_FSEBehaviorMode /t REG_DWORD /d 2 /f | Out-Null
  281.   reg add "HKCU\System\GameConfigStore" /v GameDVR_HonorUserFSEBehaviorMode /t REG_DWORD /d 1 /f | Out-Null
  282.   reg add "HKCU\System\GameConfigStore" /v GameDVR_DXGIHonorFSEWindowsCompatible /t REG_DWORD /d 1 /f | Out-Null
  283.   reg add "HKCU\System\GameConfigStore" /v GameDVR_EFSEFeatureFlags /t REG_DWORD /d 0 /f | Out-Null
  284.  
  285.   # Related services
  286.   $svc = @('XblAuthManager','XblGameSave','XboxNetApiSvc')
  287.   foreach ($s in $svc) {
  288.     Stop-Service $s -ErrorAction SilentlyContinue
  289.     Set-Service  $s -StartupType Disabled -ErrorAction SilentlyContinue
  290.   }
  291. }
  292.  
  293. # =========================
  294. # C) Verify section: ignore known NonRemovable packages
  295. # =========================
  296. $KnownNonRemovable = @('Microsoft.XboxGameCallableUI')
  297.  
  298. Write-Host "`n-- Verify removed packages (ignores NonRemovable) --" -ForegroundColor Cyan
  299. $RemoveNames |
  300.   Where-Object { $KnownNonRemovable -notcontains $_ } |
  301.   ForEach-Object { Get-AppxPackage -AllUsers -Name $_ }
  302.  
  303.  
  304. # =========================
  305. # 6) Verify quickly
  306. # =========================
  307. Write-Host "`n-- Verify removed packages (should return nothing) --" -ForegroundColor Cyan
  308. $RemoveNames | ForEach-Object { Get-AppxPackage -AllUsers -Name $_ }
  309.  
  310.  
  311.  
  312. # Start Menu Experience Host
  313. Get-AppxPackage -AllUsers Microsoft.Windows.StartMenuExperienceHost |
  314.   ForEach-Object {
  315.     Add-AppxPackage -Register -DisableDevelopmentMode "$($_.InstallLocation)\AppXManifest.xml"
  316.   }
  317.  
  318. # Shell Experience Host (taskbar/start glue)
  319. Get-AppxPackage -AllUsers Microsoft.Windows.ShellExperienceHost |
  320.   ForEach-Object {
  321.     Add-AppxPackage -Register -DisableDevelopmentMode "$($_.InstallLocation)\AppXManifest.xml"
  322.   }
  323.  
  324. # Search components (hits Win10/Win11 variants)
  325. Get-AppxPackage -AllUsers *Search* |
  326.   ForEach-Object {
  327.     if (Test-Path "$($_.InstallLocation)\AppXManifest.xml") {
  328.       Add-AppxPackage -Register -DisableDevelopmentMode "$($_.InstallLocation)\AppXManifest.xml"
  329.     }
  330.   }
  331.  
  332.  
  333. # === Apps-first Start search (Win10/Win11) ===
  334. # 1) Make sure Windows Search runs
  335. Set-Service WSearch -StartupType Automatic
  336. Start-Service WSearch
  337.  
  338. # 2) Kill web results in Start
  339. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Search" /v BingSearchEnabled /t REG_DWORD /d 0 /f | Out-Null
  340. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v ConnectedSearchUseWeb /t REG_DWORD /d 0 /f | Out-Null
  341. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v DisableSearchBoxSuggestions /t REG_DWORD /d 1 /f | Out-Null
  342.  
  343. # Older Win10 builds also honor this Explorer policy:
  344. reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v DisableSearchBoxSuggestions /t REG_DWORD /d 1 /f | Out-Null
  345.  
  346. # 3) Disable cloud/graph (M365/OneDrive) content in search
  347. reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Search" /v AllowCloudSearch /t REG_DWORD /d 0 /f | Out-Null
  348. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\SearchSettings" /v IsAADCloudSearchEnabled /t REG_DWORD /d 0 /f | Out-Null
  349. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\SearchSettings" /v IsMSACloudSearchEnabled /t REG_DWORD /d 0 /f | Out-Null
  350. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\SearchSettings" /v IsDeviceSearchHistoryEnabled /t REG_DWORD /d 0 /f | Out-Null
  351.  
  352. # 4) Use "Classic" indexing (don’t crawl entire PC)
  353. #    0 = Classic, 1 = Enhanced
  354. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\SearchSettings" /v EnableFindMyFiles /t REG_DWORD /d 0 /f | Out-Null
  355.  
  356. # 5) Restart the search service and rebuild the (smaller) index
  357. Stop-Service WSearch -Force
  358. $SearchData = "$env:PROGRAMDATA\Microsoft\Search\Data\Applications\Windows"
  359. Remove-Item "$SearchData\Windows.edb" -Force -ErrorAction SilentlyContinue
  360. Start-Service WSearch
  361.  
  362. Write-Host "`nDone. Give Start search a minute to rebuild the smaller index." -ForegroundColor Green
  363.  
  364.  
  365.  
  366.  
  367. Write-Host "`nDone. Reboot recommended." -ForegroundColor Green
  368.  
Advertisement
Add Comment
Please, Sign In to add comment