Sycnex / Windows10Debloater

Script to remove Windows 10 bloatware.
MIT License
18.07k stars 2.04k forks source link

Remove-AppxProvisionPackage -Online Windows 2004 error #308

Open xsisbest opened 3 years ago

xsisbest commented 3 years ago

All the sudden I'm getting this error on Windows 10 2004 build at the end of my MDT. I've ran this many times already from 1803 on up to 2004 and never had this till now. Not sure why as I've not changed anything in the script. Here is a screenshot and the section of the script it's erroring on.

Capture

param([switch]$Debloat)

#Removes AppxPackages
#Credit to Reddit user /u/GavinEke for a modified version of my whitelist code
[regex]$WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.WindowsSoundRecorder|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint|Microsoft.WindowsCamera|.NET|Framework|Microsoft.HEIFImageExtension|Microsoft.ScreenSketch|Microsoft.StorePurchaseApp|Microsoft.VP9VideoExtensions|Microsoft.WebMediaExtensions|Microsoft.WebpImageExtension|Microsoft.DesktopAppInstaller'
Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue
# Run this again to avoid error on 1803 or having to reboot.
Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue
$AppxRemoval = Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} 
ForEach ( $App in $AppxRemoval) {

    Remove-AppxProvisionedPackage -Online -PackageName $App.PackageName

    }

}

ThiloL commented 3 years ago

Do not remove store app.