How To Force Remove Windows Store (UWP) Apps
28 Nov 2018Introduction
I recently had a UWP app completely stop working for me, as in it wouldn’t be updated through the store, “normal” uninstallation through the Start Menu and Settings app didn’t work, PowerShell couldn’t remove it properly, and even an in-place upgrade did nothing to fix it.
This blog post is the result of 6+ hours of Google searches, fruitless chats with Microsoft Tier 1 support, and stumbling around blindly inside the undocumented parts of Windows Microsoft doesn’t want you touching.
Uninstall Steps
WARNING: The following instructions can completely break your Store installation. I am only posting what worked for me, and these instructions are provided for you to follow at your own risk. I am not responsible if anything goes wrong.
Please make backups before doing anything.
With that out of the way, here’s what I did to force the Windows Store to “forget” it had ever existed.
Normal Uninstall
Might as well try this while you’re at it, it’ll save you quite a bit of time if you manage to do it this way.
- Find the app’s full package name by running
Get-AppxPackage | Select Name, PackageFullName
and doing a “Find” inside any text editor. - Run
Remove-AppxPackage -AllUsers [the full package name here]
without the square brackets. - Hope it works.
If it errors out with 0x80073CFA (especially with 0x80070002 in another error code) then you’ll probably have to do a full manual uninstall. Be prepared to spend a couple of hours on this.
Manual Uninstall (Windows 10 1803)
This information is outdated for newer versions of Windows 10. Scroll down for the updated instructions.
Huge thanks to the people who made the following forum/blog posts:
- Microsoft Community (Archived, page navigation is broken)
- Super User (Stack Exchange) (Archived)
- DxSdata (Archived)
For reference, I was using Windows 10 1803 with the November 2018 cumulative update applied. This is untested on any other version.
- Manually delete everything that is linked to that app. This includes the following (but is not an exhaustive list)
- All folders that exactly match the app’s full package name (the package name is obtained by running
Get-AppxPackage | Select Name, PackageFullName
in PowerShell and looking for the full name). You can find them by runningdir /AD /s [your full package name here]
- All registry entries that exactly match the app’s full package name. You may be able to delete the parent folders as well, use your own judgment to figure out what’s safe or not. Again, make a full system backup before doing this, and verify the backup works first
- The XML file that matches the app’s package name in
C:\ProgramData\Microsoft\Windows\AppRepository\
- The folder that matches the app’s package name in
C:\ProgramData\Microsoft\Windows\AppRepository\Packages\
- Any entries referencing the app in
C:\ProgramData\Microsoft\Windows\AppxProvisioning.xml
- All folders that exactly match the app’s full package name (the package name is obtained by running
-
Download and install any SQLite database editor. I used DB Browser for SQLite
-
Launch your editor as
NT AUTHORITY\SYSTEM
. You can use multiple tools for this, including Process Hacker and the PSTools Suite -
Open the database
C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Deployment.srd
and look for a row in the tableAppxManifest
that has your app mentioned in theXml
column, and delete that row. Write the changes to disk (I recommend backing up the existing database first to avoid issues). - Open the database
C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd
and delete the row in the tablePackage
that has your app’s full package name in the columnPackageFullName
. This is a multi-step process, and all the instructions below are for DB Browser for SQLite.- On the “Database Structure” tab, scroll down until you see the “Triggers” section.
- Right-click on the
TRG_AFTERDELETE_Package_Key
trigger and click “Copy Create statement”. You’ll need this for later, so paste it in a text document and keep it handy. - Delete the
TRG_AFTERDELETE_Package_Key
trigger. This is to avoid SQLite complaining about “no such function: sroptions (your SQL statement here)”. - Move to the “Browse Data” tab, find the correct entry in the
Package
table, and press “Delete Record”. - Re-add the database trigger by pasting and running the trigger create statement you copied earlier. If you don’t have this, revert your changes and get it from your database backup (you did make one, right?)
- Write the database changes to disk.
- Re-open the Store. The app should now be marked as “Owned” but not “Installed”.
Manual Uninstall (Windows 10 20H2)
Updated on 2020-11-28
Thanks to Robin G and Jean B for feedback on the procedure for newer versions of Windows 10.
- Manually delete everything that is linked to that app. This includes the following (but is not an exhaustive list)
- All folders that exactly match the app’s full package name (the package name is obtained by running
Get-AppxPackage | Select Name, PackageFullName
in PowerShell and looking for the full name). You can find them by runningdir /AD /s [your full package name here]
- Some apps have additional packages installed alongside them, for example the Zoom Rooms app has
[snip]_neutral_~_r9fg4ykbbcwvc
in addition to the main package[snip]_x86__r9fg4ykbbcwvc
. Remember to delete these as well!
- Some apps have additional packages installed alongside them, for example the Zoom Rooms app has
- All registry entries that exactly match the app’s full package name. You may be able to delete the parent folders as well, use your own judgment to figure out what’s safe or not. Again, make a full system backup before doing this, and verify the backup works first
- Keys in the StateRepository cache (
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModel\StateRepository\Cache\Package\Data\
) are set to read-only for administrators so you might need to launch regedit as SYSTEM.
- Keys in the StateRepository cache (
- The XML file that matches the app’s package name in
C:\ProgramData\Microsoft\Windows\AppRepository\
- The folder that matches the app’s package name in
C:\ProgramData\Microsoft\Windows\AppRepository\Packages\
- If the app is a preinstalled or system-wide app then also remove any entries referencing the app in
C:\ProgramData\Microsoft\Windows\AppxProvisioning.xml
.- This can break things if you create a new user profile, so re-add the app once you’ve successfully reinstalled it.
- All folders that exactly match the app’s full package name (the package name is obtained by running
-
Download and install any SQLite database editor. I used DB Browser for SQLite
-
Launch your editor as
NT AUTHORITY\SYSTEM
. You can use multiple tools for this, including Process Hacker and the PSTools Suite - Open the database
C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd
and look for any rows that mention your package name. The tables I needed to delete rows from are listed below alongside any additional steps required to delete them (your app may have different entries, this is just what Zoom Rooms needed):- Activation
- In the Database Structure tab, scroll down to the Triggers section
- Find the trigger called
TRG_BEFOREDELETE_Activation_SRJournal
- Right-click its row and press “Copy Create statement”. Paste it somewhere safe - you’ll need it later.
- Delete the trigger by right-clicking it and pressing “Delete Trigger”
- Delete the row in the Activation table
- Re-add the trigger by pasting the create statement in the “Execute SQL” tab and pressing the “Execute all” button
- Application
- Follow the same steps as the
Activation
table, but this time for theTRG_BEFOREDELETE_Application_SRJournal
trigger
- Follow the same steps as the
- ApplicationIdentity
- BundlePackage (find the “Bundle” integer here - delete the associated one in “Bundle”)
- MrtApplication
- MrtPackage
- Package
Save the package ID first - we’ll need it for the next step.
- Follow the same steps as the
Activation
table, but this time for theTRG_BEFOREDELETE_Package_SRJournal
trigger
- Follow the same steps as the
- PackageFamily
- Follow the same steps as the
Activation
table, but this time for theTRG_BEFOREDELETE_PackageFamily_SRJournal
trigger
- Follow the same steps as the
- PackageIdentity
- PackageLocation
Write the changes to disk (I recommend backing up the existing database first to avoid issues).
- Activation
- Open the database
C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Deployment.srd
and look for a row in the tableAppxManifest
that has the package ID you previously got fromStateRepository-Machine.srd
in thePackage
column. Right-click the rows and delete them.- Also do this for the
File
andPackageSourceUri
tables. You can shift-click on multiple records to bulk select.
- Also do this for the
-
Run
wsreset.exe
- Re-open the Store. The app should now be marked as “Owned” but not “Installed” and should be reinstallable. If you run into an error, try pressing the “Retry” button and it should eventually redownload.
- If you don’t plan on reinstalling the app then I still recommend redownloading and uninstalling it to clean up anything not mentioned in this guide.
Wrap Up and Finishing Words
UWP is a fantastic idea. Sandbox absolutely everything and keep each app in its own folder, all with user-friendly controls through the Store and Settings apps. It succeeds in that, and I applaud the Windows team for finally catching up to macOS and some Unixes.
However, it can get extremely ugly as soon as something breaks. The only other “approved” or “sanctioned” ways to interact with the system are through a group of PowerShell cmdlets, and it’s really hard to peek behind the scenes and get an idea of what it’s actually doing. I only figured out there was a SQLite database controlling all this through a lucky Google search, which really isn’t what I’d want if I was making documentation for Windows.
If anyone on the Windows team is reading this, please, please have an option in Settings to force uninstall an app. Spending hours poking through the dark side of Windows to uninstall a single app is incredibly bad UX, and I don’t even know what caused this in the first place. Was it a botched update? Was it a stray gamma ray or something flipping a critical bit? There’s near zero visibility in what UWP does internally.
I hope these steps helped you. Feel free to drop me an email if you’ve got any comments, I really appreciate any feedback.