Debloat-Windows.ps1: All-in-One PowerShell Script to Clean Up Windows 10 & 11 (Home/Pro)

Share it:

Setting up a fresh installation of Windows 10 or Windows 11 (Home or Pro) usually means spending your first hour uninstalling preinstalled consumer apps, silencing Start menu suggestions, disabling Bing web search, and turning off intrusive telemetry. Most heavy-handed “optimizer” tools are either bloated GUIs themselves or aggressively break core components like Microsoft Store, Windows Security, or Winget.

To solve this cleanly, I built Debloat-Windows.ps1—a lightweight, transparent, single-command PowerShell script hosted on GitHub Gist. It works in both Windows PowerShell 5.1 and PowerShell 7 (pwsh), targets both Windows 10 and 11 (Home and Pro), and includes built-in safety guards like automatic System Restore point creation and a full Dry-Run preview mode.

Windows 11 laptop running Debloat-Windows.ps1 PowerShell script URL with SAFE and FULL options
Streamlining Windows 10 and 11 Home/Pro with a safe, transparent PowerShell automation workflow.

Quick Start: Run in One Command

To run the script, open an elevated PowerShell / Windows Terminal window (right-click Start → Terminal (Admin), or search for PowerShell and choose Run as administrator) and paste the raw Gist URL command:

irm https://gist.githubusercontent.com/alvikashif/278116cdca9de9718524da27b80ce4f6/raw/Debloat-Windows.ps1 | iex

Important URL & syntax notes:

  • Always use the gist.githubusercontent.com/.../raw/Debloat-Windows.ps1 URL above—not the regular gist.github.com webpage link, which returns HTML and will fail when piped to iex.
  • Use a single pipe (|) before iex and run as Administrator (without elevation, the script stops immediately and prompts you to reopen as Admin).
  • Inspect the source anytime on the public GitHub Gist page—everything is plain PowerShell with zero external binaries or hidden downloads.
Debloat-Windows.ps1 GitHub Gist overview showing modes and environment variable options
The Debloat-Windows.ps1 GitHub Gist showing supported modes, environment variable options, safety guarantees, and logging path.

Two Modes: SAFE vs. FULL

When launched interactively, the script prompts you to choose between two modes so you can decide how minimal you want your system to be:

1. SAFE Mode (Default)

  • Removes Preinstalled Consumer Apps: Uninstalls bundled bloatware across all existing user accounts and removes provisioned packages so new users won’t receive them either—including Clipchamp, Bing News/Weather/Search/Finance/Sports, Microsoft Copilot, Solitaire Collection, Outlook for Windows, Power Automate Desktop, Feedback Hub, Phone Link / Your Phone, Skype, 3D Viewer, Paint 3D, Mixed Reality Portal, Movies & TV, Spotify, Disney, Netflix, TikTok, Candy Crush, McAfee, Norton, and more.
  • Disables Ads, Suggestions & AI Clutter: Turns off Content Delivery Manager suggestions, Start menu recommendations, Lock Screen spotlight/ads, Bing web search in Start, Windows Copilot, Windows Recall (DisableAIDataAnalysis), Widgets (News & Interests), and Taskbar Chat.
  • Applies to Future Users: Loads the Default user registry hive (C:\Users\Default\NTUSER.DAT) so any new local accounts created later start clean as well.

2. FULL Mode

Includes everything in SAFE mode, plus deeper privacy and desktop cleanups:

  • Telemetry & Tracking Reduction: Sets AllowTelemetry to 0 (which sets Windows Home and Pro to the lowest Required diagnostic level), disables the DiagTrack and dmwappushservice services, and turns off Application Experience and Customer Experience Improvement Program (CEIP) scheduled tasks.
  • OneDrive Removal: Cleanly runs OneDriveSetup.exe /uninstall and disables OneDrive sync policies—while leaving any existing local files in your OneDrive folder untouched.
  • Xbox Overlay Cleanup: Removes Microsoft.GamingApp, XboxGamingOverlay, XboxSpeechToTextOverlay, Xbox.TCUI, and XboxIdentityProvider (unless excluded via $env:DEBLOAT_KEEP).
  • File Explorer & Taskbar Tweaks: Shows file extensions (HideFileExt = 0), configures File Explorer to open directly to This PC (LaunchTo = 1), and switches the taskbar search bar to a compact icon.

Windows 10 & 11 (Home vs. Pro) Compatibility & Caveats

Debloat-Windows.ps1 is designed to work across all four mainstream desktop editions—Windows 11 Home, Windows 11 Pro, Windows 10 Home, and Windows 10 Pro—with a few edition-specific behaviors to keep in mind:

  • Windows 11 Home & Pro: Both editions behave identically for app removal, UI cleanup, and policy tweaks. Note that on both Home and Pro, setting AllowTelemetry = 0 lowers diagnostic data to the Required level (only Enterprise and Education editions allow disabling it further).
  • Windows 10 Home & Pro (22H2): Core cleanup steps—System Restore point, app removal, OneDrive uninstallation, telemetry services/tasks, Start/Lock Screen ads, web search in Start, and Advertising ID—work the same way. App names that aren’t present on a given machine are cleanly skipped, while Windows 10-specific apps like Skype, Phone Link, 3D Viewer, Paint 3D, Mixed Reality, Office Hub, Movies & TV, and News/Weather are covered. Windows 11-only keys (Widgets, Chat, Copilot, Recall) are safely ignored on Windows 10 without breaking anything.
  • Managed / Domain-Joined Pro Devices: If a Windows 10/11 Pro PC is joined to an Active Directory domain or managed by Microsoft Intune/MDM, corporate policies may override or restore these settings on policy refresh.
  • Older Windows 10 Builds & Support Lifecycle: Very old Windows 10 builds prior to 1809 do not support removing Appx packages for all users via -AllUsers. Also keep in mind that Windows 10 reached end of support in October 2025—debloating improves performance and privacy, but does not replace security updates.

Built-In Safety Guardrails

Debloating scripts should never leave your PC broken or unrecoverable. Debloat-Windows.ps1 enforces several safeguards out of the box:

  • Automatic System Restore Point: Before touching any packages or registry keys, it enables System Restore on the system drive and creates a restore point named Before Debloat-Windows.
  • Hardcoded Core App Protection: Essential system apps—including Microsoft Store, Edge, Windows Security (SecHealthUI), Windows Terminal, Winget (DesktopAppInstaller), Calculator, Notepad, Photos, Paint, Snipping Tool, Sticky Notes, and Camera—are explicitly protected on a keep-list so they are never removed, even if a wildcard pattern matches.
  • Full Transcript Logging: Every action, skipped item, and registry edit is logged to C:\ProgramData\Debloat\debloat-<timestamp>.log for easy auditing.
  • Simple Rollback: You can revert system changes via Start → “Create a restore point” → System Restore, and any removed apps can be reinstalled anytime from the Microsoft Store.

Preview First with Dry-Run Mode (Screenshots)

Before making changes on a live machine—especially when trying the script on a different Windows edition—always preview first using Dry-Run mode by setting $env:DEBLOAT_DRYRUN = '1' before running the one-liner:

$env:DEBLOAT_DRYRUN = '1'
irm https://gist.githubusercontent.com/alvikashif/278116cdca9de9718524da27b80ce4f6/raw/Debloat-Windows.ps1 | iex

In the screenshot below, running Mode 1 (SAFE) with Dry-Run enabled in PowerShell 7 (pwsh.exe as Administrator) simulates the System Restore point step and lists every installed and provisioned app queued for removal—such as Clipchamp, Bing News/Search/Weather, Outlook for Windows, Power Automate Desktop, and Microsoft Family—without modifying a single file or registry value:

Running Debloat-Windows.ps1 in Administrator PowerShell dry-run mode showing preinstalled apps queued for removal
Dry-run output in PowerShell 7 (Administrator) listing preinstalled and provisioned apps targeted in SAFE mode.

Scrolling down through the output, the script prints each HKCU:\ and HKLM:\SOFTWARE\Policies\Microsoft\Windows\... registry policy it would apply—disabling consumer content delivery, Start recommendations, Bing search, Windows Copilot, Recall, Widgets, and advertising IDs—before saving the full transcript log:

Debloat-Windows.ps1 dry-run output showing registry tweaks, telemetry policies, and log file location
Dry-run registry policy preview and final transcript log output in C:\ProgramData\Debloat\.

Environment Variables Reference (ENV Options)

Because piped scripts (irm ... | iex) don’t accept traditional command-line parameters directly, Debloat-Windows.ps1 reads five environment variables set before execution:

  • $env:DEBLOAT_MODE = '1' or '2' — Choose SAFE (1) or FULL (2) and skip the interactive mode menu.
  • $env:DEBLOAT_DRYRUN = '1' — Preview every app removal, registry change, service, and task without modifying your system.
  • $env:DEBLOAT_YES = '1' — Skip the Continue? (y/N) confirmation prompt for unattended setups.
  • $env:DEBLOAT_KEEP = 'Xbox*,OneDrive' — Comma- or semicolon-separated wildcard patterns for apps that must be kept. Including the word OneDrive preserves OneDrive even in FULL mode.
  • $env:DEBLOAT_EXTRA = '*Dropbox*' — Comma- or semicolon-separated wildcard patterns for extra preinstalled apps you want removed.

How to Use Environment Variables in PowerShell 7 (pwsh) vs. Windows PowerShell 5.1

Inside an elevated terminal, setting $env: variables works identically in both PowerShell 7 (pwsh.exe) and built-in Windows PowerShell 5.1 (powershell.exe). Just set the variables first—either on separate lines or chained with semicolons (;)—and then run the irm | iex one-liner in the same session:

# Works identically in BOTH PowerShell 7 (pwsh) and Windows PowerShell 5.1
$env:DEBLOAT_DRYRUN = '1'
$env:DEBLOAT_MODE   = '2'
$env:DEBLOAT_YES    = '1'
$env:DEBLOAT_KEEP   = 'Xbox*,OneDrive'
$env:DEBLOAT_EXTRA  = '*Dropbox*'

irm https://gist.githubusercontent.com/alvikashif/278116cdca9de9718524da27b80ce4f6/raw/Debloat-Windows.ps1 | iex

If you want to launch everything as a single command from Run (Win + R), a shortcut, or an automation wrapper, use the executable matching your shell:

Option A: PowerShell 7 (pwsh)

pwsh -NoProfile -Command "$env:DEBLOAT_MODE='2'; $env:DEBLOAT_YES='1'; $env:DEBLOAT_KEEP='Xbox*,OneDrive'; irm https://gist.githubusercontent.com/alvikashif/278116cdca9de9718524da27b80ce4f6/raw/Debloat-Windows.ps1 | iex"

Option B: Windows PowerShell 5.1 (powershell.exe, built into Windows 10 & 11)

powershell -NoProfile -ExecutionPolicy Bypass -Command "$env:DEBLOAT_MODE='2'; $env:DEBLOAT_YES='1'; $env:DEBLOAT_KEEP='Xbox*,OneDrive'; irm https://gist.githubusercontent.com/alvikashif/278116cdca9de9718524da27b80ce4f6/raw/Debloat-Windows.ps1 | iex"

Three quick PowerShell 5.1 vs. PowerShell 7 tips:

  • Use ; instead of &&: PowerShell 7 supports && command chaining, whereas Windows PowerShell 5.1 does not. Using semicolons (;) or separate lines works reliably on both versions.
  • Don’t use set DEBLOAT_MODE=2 inside PowerShell: Unlike Command Prompt (cmd.exe), set in PowerShell is an alias for Set-Variable and will not set an environment variable. Always use the $env:NAME = 'value' prefix.
  • TLS 1.2 on fresh Windows 10 PowerShell 5.1: PowerShell 7 enables TLS 1.2+ automatically, while older Windows 10 builds running PowerShell 5.1 occasionally default to TLS 1.0. If irm gives a secure channel error, run [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 before the one-liner.

Environment variables set with $env: exist only for the current terminal window and vanish automatically when you close it (or you can clear them mid-session with Remove-Item Env:DEBLOAT_*). Once the script finishes, Explorer automatically restarts to apply UI tweaks, and a quick sign-out or reboot completes the remaining policy changes.

Explore More Automation & Security Guides on LifeMint:

Kashif Alvi

About the Author: Kashif Alvi

Kashif is a Systems Administrator & DevOps Specialist based in Mumbai, India. With deep hands-on expertise in Linux server administration, cloud infrastructure (Cloudflare, Oracle Cloud), network security, and homelab automation, he writes tested technical guides to help developers, sysadmins, and tech enthusiasts self-host, secure, and optimize their infrastructure.

Learn more about Kashif →