14

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?

4
  • 1
    Try the PowerShell script in the last entry of this post : Clean removal of system apps (bypass error 0x80073CFA).
    – harrymc
    Commented Aug 24, 2016 at 8:19
  • Please answer .
    – harrymc
    Commented Aug 26, 2016 at 8:41
  • @PIMP_JUICE_IT But that is to reinstall all apps from the provisioned packages AFTER uninstalling them from the user account. I couldn't uninstall any of them in the first place, that is the problem.
    – Ryakna
    Commented Aug 30, 2016 at 6:40
  • @Ryakna have you checked the hack that I found in the net? Commented Jul 1, 2017 at 7:13

4 Answers 4

8

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.

9
  • Thanks a lot for this info. Helped me to manually delete the broken store application which it was not possible to delete any other way (power shell included).
    – ElDog
    Commented Oct 17, 2017 at 22:12
  • It seems that this no longer works in later Windows 10 builds. The database now contains triggers which run user-defined functions, so any update fails ("Error: no such function: workid") if the loading application does not install the necessary function(s). Commented Sep 4, 2019 at 19:19
  • @TimSylvester which app do you want to uninstall? In 1903 you can uninstall more inbox apps. Commented Sep 5, 2019 at 13:59
  • Hi, I know this is rather old now but I just nuked a laptop because it wouldn't update and doing this process seems vaguely familiar. I can't recall if I did in fact do this, but is there a way to determine if I had removed the update restricting apps (obviously on other systems)? Any way where I can check using PDQ Inventory so I can grab a list of affected systems, and lastly, if I reinstall the apps, will future upgrades resume? Or is this moot now with the latest version of Windows because I think it is rather silly of MS to prevent updates over something this silly. Commented Jan 22, 2020 at 14:47
  • 2
    This answer is outdated, on Windows 10 20H2, trying to clear IsInBox flags without deleting TRG_AFTER_UPDATE_Package_SRJournal first will cause "is_srjournal_enabled" error, see my answer: superuser.com/a/1618323/1250181 Commented Jan 17, 2021 at 10:38
7
+50

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

function Enable-Privilege {  
  param($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;
    tp.Attr = SE_PRIVILEGE_ENABLED;
    retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid);
    retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero,
      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.SetOwner($owner)
  $key.SetAccessControl($acl)

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

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.

10
  • Thanks for your answer. I've tried the script in some other systems and it indeed works for almost all universal apps, even some usually irremovable ones, however, on the problematic system, the problem unfortunately persists and the script does not work. It shows the exactly same error messages in the powershell with all apps I try to remove.
    – Ryakna
    Commented Aug 30, 2016 at 6:35
  • If this still happens when PowerShell is invoked with "Run as administrator", then something is very wrong on that computer. If this is as problem with the Store, try these 5 Tips to Fix Windows Store and App Issues in Windows 10.
    – harrymc
    Commented Aug 30, 2016 at 9:06
  • @harrymc It did not work using $packageBase = "xboxapp", "officehub", "skypeapp"
    – JinSnow
    Commented May 30, 2019 at 7:32
  • This answer no longer works on Windows 10 20H2, I have confirmed it. Commented Jan 17, 2021 at 10:42
  • @XeнεiΞэnвϵς: Is that the reason for the downvote?
    – harrymc
    Commented Jan 17, 2021 at 10:55
2

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.

6
  • Thanks for your time. The problem is that this Windows image is from November and is not connected to the internet yet so not updated. Besides, I just tried to uninstall the store and the calculator from an up-to-date Windows 10 using the same method and was able to do it without any problem.
    – Ryakna
    Commented Aug 20, 2016 at 22:58
  • @Ryakna Ah ok, well, I will leave my answer there in case someone wants to know alternative ways to remove them lol
    – Frostalf
    Commented Aug 21, 2016 at 0:05
  • I can't rename SystemApps folder. I had to remove the Xbox app folder using BleachBit, wasn't possible by official means. The Xbox app is still installed, Game Bar process location is ~\Windows\System32. Is it safe to remove GameBar* and GamePanel* files there?
    – user198350
    Commented Aug 23, 2016 at 10:35
  • @user598527 If you don't uninstall the app through official means (i.e. through PowerShell) and just remove or rename the folder, the app doesn't really get uninstalled and can cause problems later down the road. And you should not rename the SystemApps folder as it is essential in Windows 10. FYI the Windows Universal Apps folders are C:\Windows\SystemApps for system app files, C:\Program Files\WindowsApps for other app files and C:\Users\Ryakna\AppData\Local\Packages for app data.
    – Ryakna
    Commented Aug 23, 2016 at 10:56
  • 1
    @user598527 You have probably removed some of them (there are a lot of Xbox AppX) but I think the main Xbox backbone is not uninstallable. By running Get-AppxPackage | Select Name, PackageFullName on PowerShell you can see you still have Xbox AppX in your system. I think you can remove the game bar if you stop and disable the Xbox services (Probably Xbox Live Networking Service)
    – Ryakna
    Commented Aug 23, 2016 at 11:45
0

You need to specify -allUsers for both Get-AppXPackage and Remove-AppXPackage. That's why the error says you can't uninstall an AllUsers package from a user account; you got the reference for AllUsers, but then tried uninstalling it for a single user.

Get-AppXPackage -allUsers *windowscalculator* | Remove-AppXPackage -allUsers

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .