What It Does
This script changes nothing until you set DryRun=false and Approve=remove-windows-bloatware. Before that it lists what it would do and how many changes that is. It refuses to make more than 25 changes in one run unless you raise MaxChanges, and the dry run warns the number to use.
It removes a fixed, safe list of consumer apps twice: from every existing user profile with Remove-AppxPackage -AllUsers, and from the Windows image with Remove-AppxProvisionedPackage, so users created later do not get them back. The default list includes Candy Crush and other King games, Spotify, Disney+, TikTok, Prime Video, Clipchamp, Bing News, Weather, Finance and Sports, Solitaire Collection, Feedback Hub, Groove Music, Movies and TV, the 3D apps, Tips and Skype. RemoveXbox and RemovePhoneLink add their respective packages to the list. ExtraApps can also match those packages, subject to the protected list.
It never touches, whatever ExtraApps says, Microsoft Store, App Installer, Calculator, Photos, Notepad, Terminal, Paint, Snipping Tool, Edge, Teams, Outlook, Office, OneDrive, Company Portal, Windows Security, any framework or runtime package, anything Windows marks as non-removable or as a system app, and anything under Microsoft.Windows or MicrosoftWindows. On Windows 11, Microsoft.ZuneMusic is also the Media Player app, so add it to KeepApps to keep it.
Before the first change it saves the list of every package it will remove to a backup folder as removed-apps.csv, so an app can be put back. DisableConsumerFeatures also sets the policy that stops Windows installing promoted apps for new users, which Microsoft applies on Enterprise and Education only. Removal can close an open app or fail if Windows has it locked. A feature update can bring a removed app back, so run the check again after one.
Before You Run It
- Run it as a dry run first and read the list of apps and the number of changes.
- Add Microsoft.ZuneMusic to KeepApps if the client uses Media Player on Windows 11.
- Raise MaxChanges to the number the dry run plans if you use many ExtraApps or RemoveXbox.
- Run it again after a Windows feature update. It says Nothing to remove when the PC is clean.
Type and Risk
- Type: Action. It makes its change, checks the change worked and says what changed. It exits 0, or 2 when it could not do the job.
- Risk: High. It is a dry run unless you set both DryRun=false and Approve=remove-windows-bloatware, and it stops before making more than 25 changes in one run unless you raise MaxChanges. Run it once as a dry run and read the list first.
- What it changes: Removes listed consumer Appx packages for all users and from the Windows image; optionally sets one policy value.
- Restart: It never restarts the machine.
- Typical run: 1 to 5 minutes.
- Example answer: "Removed 14 app(s) for all users and 15 from the image; kept 1 by KeepApps"
- Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.
Inputs
Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.
- RemoveXbox: true also removes the Xbox app, the Xbox Game Bar overlay and the Gaming app. The Xbox identity and Gaming Services packages stay. Default false.
- RemovePhoneLink: true also removes Phone Link (Microsoft.YourPhone). Default false.
- DisableConsumerFeatures: true sets the policy "Turn off Microsoft consumer experiences" (HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent DisableWindowsConsumerFeatures = 1), so Windows stops installing promoted apps for new users. Microsoft applies this policy on Enterprise and Education editions only; on Pro it is stored but has no effect. The key is exported to the backup folder first. Default false.
- ExtraApps: More package names to remove, a list separated by comma or semicolon. The * and ? wildcards work on the package Name (for example Microsoft.Bing*, ContosoPromo.*). At least 3 characters besides wildcards. Never overrides the protected list. Default empty.
- KeepApps: Package names to keep even though they are on the list (wildcards work), for example Microsoft.ZuneMusic or Microsoft.Bing*. Default empty.
Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.
License
Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.