Removing AppX Packages with PowerShell

By | 2021-Feb-25

Uninstalling an AppX package will remove it from the current user’s start menu and applications list, but it will continue to appear for other users unless the AppX provisioned package is also removed.

This script should be run in an Administrative PowerShell. It loops through a comma-separated list of AppX package names and (a) removes each package for the current user and (b) removes any corresponding AppXProvisioned package (when found). Clone or download this script from GitHub where it is licensed under the GPL 2.0.

# README
# Run this script in an Administrative PowerShell to remove listed
# AppXPackages and corresponding AppXProvisionedPackages.

# VARIABLES
# Comma-separated list of AppX Packages to remove
# Get package names using PS C:\> (Get-AppxPackage).Name
$AppXPackages = @(
  "Microsoft.BingWeather",
  "Microsoft.GetHelp",
  "Microsoft.Getstarted",
  "Microsoft.Messaging",
  "Microsoft.MicrosoftSolitaireCollection",
  "Microsoft.OneConnect",
  "Microsoft.People",
  "Microsoft.SkypeApp",
  "Microsoft.Wallet",
  "Microsoft.windowscommunicationsapps",
  "Microsoft.WindowsMaps",
  "Microsoft.YourPhone",
  "Microsoft.ZuneMusic",
  "Microsoft.ZuneVideo"
)

# MAIN
# Remove AppxPackage
ForEach ($Package in $AppXPackages) {
  if ($null -ne (Get-AppxPackage $Package).PackageFullName) {
    Remove-AppxPackage -Package (Get-AppxPackage $Package).PackageFullName
  }
}
# Remove AppxProvisionedPackage
ForEach ($Package in (Get-AppxProvisionedPackage -Online)) {
  if ($AppxPackages -Contains $Package.DisplayName) {
    Remove-AppXProvisionedPackage -Online -PackageName $Package.PackageName
  }
}

Relevant Links