Skip to content

Instantly share code, notes, and snippets.

@GabiNun
Last active February 14, 2026 14:17
Show Gist options
  • Select an option

  • Save GabiNun/6605ed5711a412e06db096b4e23cb4f2 to your computer and use it in GitHub Desktop.

Select an option

Save GabiNun/6605ed5711a412e06db096b4e23cb4f2 to your computer and use it in GitHub Desktop.
# This is an example of how to use the Windows Runtime (C#)
# Windows.Management.Deployment API in PowerShell to remove AppX packages,
# which is significantly faster than using Remove-AppxPackage.
$Packages =
'Microsoft.WindowsCalculator',
'Microsoft.WindowsCamera',
'Microsoft.WindowsAlarms',
'Microsoft.WindowsFeedbackHub',
'Microsoft.ZuneMusic',
'Microsoft.MicrosoftOfficeHub',
'Microsoft.BingSearch',
'Clipchamp.Clipchamp',
'Microsoft.BingNews',
'MSTeams',
'Microsoft.WindowsNotepad',
'Microsoft.Todos',
'Microsoft.OutlookForWindows',
'Microsoft.Paint',
'Microsoft.Windows.Photos',
'Microsoft.PowerAutomateDesktop',
'MicrosoftCorporationII.QuickAssist',
'Microsoft.ScreenSketch',
'Microsoft.MicrosoftSolitaireCollection',
'Microsoft.WindowsSoundRecorder',
'Microsoft.MicrosoftStickyNotes',
'Microsoft.BingWeather',
'Microsoft.WebMediaExtensions',
'Microsoft.GamingApp',
'Microsoft.Xbox.TCUI',
'Microsoft.Windows.DevHome',
'Microsoft.GetHelp',
'Microsoft.WindowsStore',
'MicrosoftWindows.CrossDevice',
'Microsoft.ApplicationCompatibilityEnhancements',
'Microsoft.YourPhone',
'Microsoft.XboxGamingOverlay',
'MicrosoftWindows.Client.WebExperience'
$pm = [Windows.Management.Deployment.PackageManager, Windows.Management.Deployment, ContentType = WindowsRuntime]::new()
Stop-Process -Name Widgets
foreach ($package in $pm.FindPackages()) {
if ($Packages -contains $package.Id.Name) {
$pm.RemovePackageAsync($package.Id.FullName) | Out-Null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment