Unable to uninstall Universal Apps through PowerShell


I was in the process of uninstalling all the Universal Apps from a new Windows 10 installation when I hit a roadblock.

It's not the first time I do this and it always goes well. However, this time, whenever I write in PowerShell

Get-AppxPackage -allusers | Remove-AppxPackage

or something more specific like

Get-AppxPackage -allusers *windowscalculator* | Remove-AppxPackage

I get the following message:

Remove-AppxPackage : Deployment failed with HRESULT: 0x80073CFA, Removal failed. Please contact your software vendor. (Exception from HRESULT: 0x80073CFA) error 0x80070032: AppX Deployment Remove operation on package Microsoft.WindowsCalculator_10.1605.1582.0_x64__8wekyb3d8bbwe from: C:\Program Files\WindowsApps\Microsoft.WindowsCalculator_10.1605.1582.0_x64__8wekyb3d8bbwe failed.

This app is part of Windows and cannot be uninstalled on a per-user basis. An administrator can attempt to remove the app from the computer using Turn Windows Features on or off. However, it may not be possible to uninstall the app.

NOTE: For additional information, look for [ActivityId] 75c5fc31-fb20-0001-77fd-c57520fbd101 in the Event Log or use the command line Get-AppxLog -ActivityID 75c5fc31-fb20-0001-77fd-c57520fbd101

At line:1 char:49

+ Get-appxpackage -allusers *windowscalculator* | Remove-AppxPackage + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (Microsoft.Windo...__8wekyb3d8bbwe:String) [Remove-AppxPackage], IOException + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand

I'm getting this message for every single app I try to uninstall, including those I know are perfectly uninstallable like the calculator or image viewer, which has never happened before.
Powershell is running elevated and everything else works and seems normal.

Is there something I can do besides reinstalling Windows?

asked on Super User Aug 20, 2016 by Ryakna • edited Aug 23, 2016 by Ryakna

3 Answers


The post Clean removal of system apps (bypass error 0x80073CFA) contains this PowerShell script :

function Enable-Privilege {  
  $Definition = @'
using System;  
using System.Runtime.InteropServices;  
public class AdjPriv {  
  [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
  internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,
    ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr rele);
  [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
  internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr phtok);
  [DllImport("advapi32.dll", SetLastError = true)]
  internal static extern bool LookupPrivilegeValue(string host, string name,
    ref long pluid);
  [StructLayout(LayoutKind.Sequential, Pack = 1)]
  internal struct TokPriv1Luid {
    public int Count;
    public long Luid;
    public int Attr;
  internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
  internal const int TOKEN_QUERY = 0x00000008;
  internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
  public static bool EnablePrivilege(long processHandle, string privilege) {
    bool retVal;
    TokPriv1Luid tp;
    IntPtr hproc = new IntPtr(processHandle);
    IntPtr htok = IntPtr.Zero;
    retVal = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
      ref htok);
    tp.Count = 1;
    tp.Luid = 0;
    retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid);
    retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero,
    return retVal;
  $ProcessHandle = (Get-Process -id $pid).Handle
  $type = Add-Type $definition -PassThru
  $type[0]::EnablePrivilege($processHandle, $Privilege)

function Take-Over($path) {  
  $owner = [Security.Principal.NTAccount]'Administrators'

  $key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey($path, 'ReadWriteSubTree', 'TakeOwnership')
  $acl = $key.GetAccessControl()

  $acl = $key.getaccesscontrol()
  $rule = New-Object System.Security.AccessControl.RegistryAccessRule "Administrators", "FullControl", "ContainerInherit", "None", "Allow"

do {} until (Enable-Privilege SeTakeOwnershipPrivilege)

function Remove-Package($name) {  
  $key = "SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\$name"
  Take-Over $key
  Remove-Item -Path HKLM:"$key\Owners" -Force -Recurse
  & C:\Windows\System32\PkgMgr.exe /up:$name /norestart /quiet

#Remove Feedback
$packageBase = "Microsoft-WindowsFeedback"
$packageNames = (dir ("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\" + $packageBase + "*")).name

forEach ($package in $packageNames)
    Remove-Package $package.substring($package.indexOf($packageBase))

On using this script, the author remarks :

You can change $packageBase to different package names.

I have not tried this script myself.

EDIT: This script might not work any more, or may need adjustments.

answered on Super User Aug 26, 2016 by harrymc • edited Jan 17, 2021 by harrymc

Starting with Windows 10 Anniversary update, Microsoft added a new entry IsInbox in the SQLite database C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd for the inbox apps. And trying to remove app app flagged as IsInbox fails with 0x80073CFA.

But there is an ugly workaround, that was discovered in April 2017.

You need to download and install the tools ProcessHacker and DB Browser for SQLite.

  • run ProcessHacker 2 as admin, select a C:\Windows\System32\svchost.exe, do a rightclick and select Misc->Run as this user

enter image description here

Now select here C:\Program Files\DB Browser for SQLite\DB Browser for SQLite.exe and start it. In SQLite Browser, click on Open database

enter image description here

and open the file C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd (change the file type in open dialog to all files to see it).

Now, click on the Browse Data tab, and change the table to Package

enter image description here

Now select the apps you want to remove and change the 1 for the column IsInbox to 0 and save the changes.

enter image description here

repeat this for all apps you want to remove and now the PowerShell commands should work.

But the author writes that Microsoft blocks the upgrade to newer Windows builds if inbox apps are removed. So keep this in mind.

answered on Super User Jun 26, 2017 by magicandre1981 • edited Jul 6, 2020 by music2myear

Windows Anniversary update, made quite a few changes that prevents you from turning off certain features, such as cortana or removing apps through official means. Some apps like the xbox app microsoft deemed it as an important app to the system thus preventing official means to remove it.

If you go into the start menu, you can right click it and click uninstall, conversely you can right the start button, go to settings, then apps and features and uninstall it from there.

Now if you are insistent on removing these apps. They are kept in C:\windows\SystemApps So you could find the folder it is kept in and just remove the folder or the safer option is to rename it and add a character such as the underscore _ to the end of the name.

Just to add, if you remove a folder or rename it inside the systemapps folder, this is technically not uninstalling it, rather just forcefully removing it, if you deleted the folder which could leave other stuff installed still like registry keys and other files elsewhere that it uses but not located in the systemapps folder, or forcing it to not run if you renamed the folder.

As Ryakna said in the comments below, using either two of these options can cause problems later down the road, however from my experience I have yet to run into any issues, including updating. But its still recommended to uninstall by official means, either by using powershell if you are familiar with it or through the programs and features option or menu option. The SystemApps folder should not be renamed or deleted, as if you do this, you will most likely encounter problems than if you were to rename or remove a folder inside the systemapps folder.

answered on Super User Aug 20, 2016 by Frostalf • edited Aug 23, 2016 by Frostalf

User contributions licensed under CC BY-SA 3.0