Remove AppxPackage - PowerShell


Overview

Remove-AppxPackage removes one or more AppX applications from the system, including all associated data and registry settings. It is commonly used to uninstall packaged applications that are no longer needed, such as pre-installed bloatware or outdated apps that are causing issues.

Syntax

Remove-AppxPackage [-Package] <PackageFullName> [[-Force] [[-RetainAppdata] [[-License] <Filepath>] [[-ProviderName] <ProviderName>] [[-Staged]] [[-Online]] [[-cs] [<Credential Object>]]]

Options/Flags

  • -Package, -Name: Specifies the full package name of the AppX application(s) to be removed. Required.
  • -Force: Suppresses confirmation prompts and forces the uninstallation, even if the package is currently in use.
  • -RetainAppdata: Retains the application’s data and settings, even after uninstallation.
  • -License: Specifies the location of a license file to use during the uninstallation.
  • -ProviderName: Specifies the name of the package provider.
  • -Staged: Uninstalls the staged package, which is a pending installation that has not yet been committed.
  • -Online: Uninstalls the package from an online source.
  • -cs, Credential: Specifies a PSCredential object if the operation requires elevated privileges.

Examples

Simple Removal:

Remove-AppxPackage -Package Microsoft.Xbox.GameBar

Forceful Removal with Data Retention:

Remove-AppxPackage -Package Microsoft.ZuneMusic -Force -RetainAppdata

Common Issues

  • Package Not Found: Ensure the specified package name is accurate and correctly formatted.
  • Package in Use: Use the -Force option to bypass this error and remove the package even if it is running.
  • Access Denied: Run the command using an elevated PowerShell window or specify credentials using the -cs parameter.

Integration

Combine with Get-AppxPackage:

Get-AppxPackage | Remove-AppxPackage -Force

Uninstall Staged Package:

Remove-AppxPackage -Staged Microsoft.TestPackage.Staged
  • Get-AppxPackage: Retrieves information about installed AppX packages.
  • Add-AppxPackage: Installs an AppX package.
  • Update-AppxPackage: Updates an existing AppX package.