Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Anything listed within this array will not be removed.
- $retain = @(
- 'Microsoft.DesktopAppInstaller',
- 'Microsoft.Messaging',
- 'Microsoft.MSPaint',
- 'Microsoft.StorePurchaseApp',
- 'Microsoft.Windows.Photos',
- 'microsoft.windowscommunicationsapps',
- 'Microsoft.WindowsCalculator',
- 'Microsoft.WindowsStore',
- 'Microsoft.ZuneMusic',
- 'Microsoft.ZuneVideo'
- );
- $apps = Get-AppxProvisionedPackage -Online
- foreach($app in $apps) {
- # If it exists within the retain array then skip this item and move onto the next.
- if($retain.Contains($app.DisplayName)) { continue; }
- # Get the package, if its installed for the current user remove it.
- $package = Get-AppxPackage -Name $app.DisplayName;
- if(($package).PackageFullName) {
- Get-AppxPackage $app.DisplayName | Remove-AppxPackage;
- }
- # Unprovision the package so new users don't have to put up with it.
- Remove-AppxProvisionedPackage -Online -PackageName $app.PackageName;
- }
Advertisement
Add Comment
Please, Sign In to add comment