Windows – Force-remove a Windows 10 Appx package, skipping any errors that might occur

uninstalluwpwindows 10

I bought the pre-order version of Forza Motorsport 7 in September. During installation of the pre-order, an error occurred which left the installation mostly installed. Forza Motorsport is delivered via the Windows Store, and is distributed via the Appx App Packager.

Now that Forza Motorsport 7 has "gone gold", I'd like to install the full version of the game. Typically this automatically occurs when you run the pre-order "stub" application, however because of the problem during the initial installation, the full game is not downloading.

My first thought was do a simple "uninstall and re-install", however attempting to uninstall the app using the "Apps and Features" page in Settings results in this error:

We couldn't uninstall Forza Motorsport 7.
The operation did not complete successfully. Try again in a bit.
The error code is 0x8000000e, in case you need it.

Not helpful. Next I used Get-AppxPackage *Apollo* (Apollo is the code name for this game) via PowerShell to obtain the Appx Package Name for the game, then used Remove-AppxPackage "Microsoft.ApolloBaseGame_1.0.2.2_64__xwekyb3d8bbwe" to uninstall the app. That doesn't work with the following error:

PS C:\WINDOWS\system32> Remove-AppxPackage Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe
Remove-AppxPackage : Deployment failed with HRESULT: 0x80073CFA, Removal failed. Please contact your software vendor.
Deployment Remove operation with target volume E: on Package Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe from: failed with error 0x80070002. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues.
NOTE: For additional information, look for [ActivityId] 59ff267b-3c76-0002-2d54-ff59763cd301 in the Event Log or use the command line Get-AppxLog -ActivityID 59ff267b-3c76-0002-2d54-ff59763cd301
At line:1 char:1
+ Remove-AppxPackage Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbw …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Apoll…__8wekyb3d8bbwe:String) [Remove-AppxPackage], IOException
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand

As recommended in the output above, I ran Get-Appxlog to see the actual error:

PS C:\WINDOWS\system32> Get-AppxLog -ActivityID 59ff267b-3c76-0002-2d54-ff59763cd301

Time                      ID           Message
----                      --           -------
2017-10-03 2:43:13 PM     603          Started deployment Remove operation on a package with main parameter: Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe and Options: 0. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app
                                       deployment issues.
2017-10-03 2:43:13 PM     10002        Creating Resiliency File C:\ProgramData\Microsoft\Windows\AppRepository\b5d59b38-d0ce-4730-a93c-da39a1a1d34e_S-1-5-21-2808904017-3304153599-3912926511-1001_2.rslc for Remove Operation on Package
                                       Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe.
2017-10-03 2:43:13 PM     607          Deployment Remove operation on package Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe has been de-queued and is running for user SID S-1-5-21-2808904017-3304153599-3912926511-1001.
2017-10-03 2:43:13 PM     605          The last successful state reached was BundleProcessed. Failure occurred before reaching the next state Indexed. hr: 0x80070002
2017-10-03 2:43:13 PM     401          Deployment Remove operation with target volume E: on Package Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe from:   failed with error 0x80070002. See http://go.microsoft.com/fwlink/?LinkId=235160 for help
                                       diagnosing app deployment issues.
2017-10-03 2:43:13 PM     404          AppX Deployment operation failed for package Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe with error 0x80073CFA. The specific error text for this failure is: Deployment Remove operation with target volume E: on
                                       Package Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe from:   failed with error 0x80070002. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues.

Error: 0x80070002 seems to indicate a "file not found" error. Although the messaging doesn't show which file was not found. So helpful.

Next, I tried using DISM.exe to remove the package:

C:\WINDOWS\system32>C:\Windows\system32\Dism.exe /online /remove-provisionedappxpackage /packagename:Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe

Deployment Image Servicing and Management tool
Version: 10.0.15063.0

Image Version: 10.0.15063.0


Error: 2

The system cannot find the file specified.

The DISM log file can be found at C:\WINDOWS\Logs\DISM\dism.log

Relevant content from the DISM log file:

2017-10-03 14:57:36, Info                  DISM   DISM Appx Provider: PID=8912 TID=10092 Processing 'packagename' option at index 2 - CAppxManager::ProcessCommandRemoveAllUserAppx
2017-10-03 14:57:36, Info                  DISM   DISM Appx Provider: PID=8912 TID=10092 packagename='Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe' - CAppxManager::ProcessCommandRemoveAllUserAppx
2017-10-03 14:57:36, Error                 DISM   DISM Appx Provider: PID=8912 TID=10092 Failed to open 'C:\Program Files\WindowsApps\Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe\AppxMetadata\AppxBundleManifest.xml'. - CPackageAdapter::GetOptionalPackagesForMainPackage(hr:0x80070002)
2017-10-03 14:57:36, Warning               DISM   DISM Appx Provider: PID=8912 TID=10092 Getting optional package list for 'Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe' hit error 0x80070002 - CAppxManager::RemoveAllUserAppx
2017-10-03 14:57:36, Error                 DISM   DISM Appx Provider: PID=8912 TID=10092 Failed to get the list of packages to remove - CPackageAdapter::DeregisterMainPackageAndGetDependencyPackages(hr:0x80070002)
2017-10-03 14:57:36, Error                 DISM   DISM Appx Provider: PID=8912 TID=10092 Failed to deregister main package and get its dependent packages - CPackageAdapter::DeregisterPackageOnline(hr:0x80070002)
2017-10-03 14:57:36, Error                 DISM   DISM Appx Provider: PID=8912 TID=10092 Failed to deregister packages. - CPackageAdapter::RemovePackageOnline(hr:0x80070002)
2017-10-03 14:57:36, Error                 DISM   DISM Appx Provider: PID=8912 TID=10092 Encountered failure while removing package Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe - CAppxManager::RemoveAllUserAppx(hr:0x80070002)
2017-10-03 14:57:36, Error                 DISM   DISM Appx Provider: PID=8912 TID=10092 Failed to remove package 'Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe' - CAppxManager::ProcessCommandRemoveAllUserAppx(hr:0x80070002)
2017-10-03 14:57:36, Error                 DISM   DISM Appx Provider: PID=8912 TID=10092 Failed processing command to remove Appx package - CAppxManager::ExecuteCmdLine(hr:0x80070002)

Using the command-line, I can verify that C:\Program Files\WindowsApps\Microsoft.ApolloBaseGame_1.0.2.2_x64__8wekyb3d8bbwe\AppxMetadata\AppxBundleManifest.xml does not exist. However, I cannot create the file, nor can I copy a file into that location. Even if I run cmd.exe as system, via PsExec:

psexec -e -i -h -s cmd.exe

Is there some way to manually get rid of an Appx package that cannot be uninstalled? Alternately, is there some way to manually trigger a re-install of an appx?

I could boot from a Windows PE environment and create a fake AppxBundleManifest.xml file, but I feel like a fake xml manifest will likely just make things worse. Presumably that manifest file typically contains dependency information that is needed by the uninstall process.

Do I have to format C: and re-install? Really?

Best Answer

The only way I was able to resolve this was by reinstalling Windows cleanly. In my opinion, Microsoft should create a way to force re-install an app.