Uninstall Windows Built-in Apps With Powershell

The following Powershell script uninstalls Windows built-in apps for all users on a machine with specific exceptions:


$GoodPackages = 'Camera',

'Calculator',

'Microsoft.WindowsCalculator',

'Microsoft.WindowsCamera',

'Microsoft.SecHelathUI',

'Microsoft.VP9VideoExtension',

'Microsoft.WebMediaExtensions',

'Microsoft.WindowsTerminal',

'Microsoft.Paint',

'Microsoft.MSPaint',

'Microsoft.MicrosoftEdge*',

'Microsoft.Net*',

'Microsoft.WindowsNotepad',

'MicrosoftTeams',

'Microsoft.MicrosoftStickyNotes',

'Microsoft.ScreenSketch',

'Office',

'OneNote for Windows 10',

'Notepad',

'snip & sketch',

'Voice Recorder'


$packages = Get-AppxPackage -allusers | Where-Object {$_.Name -notin $GoodPackages}


foreach ($package in $packages) {

Remove-AppxPackage -allusers $package.PackageFullName

}


$provisionedPackages = Get-AppxProvisionedPackage -online | Where-Object {$_.displayName -notin $GoodPackages}


foreach ($provisionedPackage in $provisionedPackages) {

Remove-AppxProvisionedPackage -online -packageName $provisionedPackage.PackageName

}