How to uninstall an app that another user installed?
Asked Answered
O

15

63

I keep hitting this problem when I try to debug my Windows 8 apps and there is a copy already installed on another user account:

DEP0700 : Registration of the app failed. Another user has already installed a packaged version of this app. An unpackaged version cannot replace this. The conflicting package is {{{PackageName}}} and it was published by CN={{{Certificate Stuff}}}. (0x80073cf9)

Sometimes I can just log in or ask someone else to log in to the machine and uninstall the app. Alternatively I can change the application name/id, but one is not always possible and the other is risky (I don't want to check in the changed application id to source control).

There must be some way to uninstall it. Maybe a PowerShell script?

Oarsman answered 13/12, 2012 at 18:15 Comment(4)
To add to my problem - right now I got the other guy to uninstall the app, but it seems like the binaries are stuck in Program Files and I can't remove the files even after changing folder/file permissions and becoming their owner. Probably something about Windows securing that folder from hackers.Oarsman
check out here for what microsoft recommends for your problem the main reason would be your developer license might get expired,check out other reasons here social.msdn.microsoft.com/Forums/en-US/toolsforwinapps/thread/…Innovation
I've reported this issue on Microsoft Connect, I hope MS will provide a way to fix this somehow. Feel free to vote for it: connect.microsoft.com/VisualStudio/feedback/details/816102/…Gangrene
I noted that the issue reported on Microsoft Connect was not 100% the issue. I've posted a new issue on Connect that better describes the matter. The more votes the better chance MS will fix it. connect.microsoft.com/VisualStudio/feedbackdetail/view/934709/…Relativistic
N
26

My process above still works, but it simply gets around a race condition issue, where Windows Update (yes, oddly enough) is in charge of wiping out "staged packages."

According to Microsoft, the "other fix" - and I still consider this issue to be a bug - is:

Cause of the problem:

Windows Update (WU) downloads newer versions of packages you have and “stages” them as Local System, so that when you go to the store to update the apps, the update process is as quick as possible. WU will eventually clean up the staged packages that were never installed.

What are some consequences of having "Staged" packages?

  1. Staged packages prevent you from installing that particular package in development mode

  2. Staged packages eat up some disk space, but due to hardlinking, the effect of this is mitigated. If a file is identical between multiple versions of a package, appx deployment hardlinks the files instead of maintaining two separate copies of the same file.

How do I find the "Staged" packages?

  1. In an administrator powershell prompt, the command:

    get-appxpackage -all

will display all packages on the machine. For a staged package, the PackageUserInformation will show {S-1-5-18 [Unknown user]: Staged} 2. Using powershell filtering, to get the list of all staged packagefullnames, you could do:

get-appxpackage -all |% {if ($_.packageuserinformation.installstate -eq "Staged"){$_.packagefullname}}

How do I get rid of the "Staged" packages?

  1. Download psexec from sysinternals tools, written by Mark Russinovich

  2. To get rid of all of them, run in a regular admin/elevated command prompt (not powershell):

psexec -s powershell -c "get-appxpackage | remove-appxpackage"

Naughton answered 18/1, 2013 at 20:15 Comment(6)
To remove just the one package causing the problem, use I used the following line: psexec -s powershell -c "Get-AppxPackage -all | where name -eq "APP.NAME" | Remove-AppxPackage"Balling
psexec is not available for WinRT >:(Mid
Sadly this does not seem to work on Windows 8.1. When running from an Administrator command prompt, I get this error: Windows cannot remove 8eeaff03-92dd-46c9-84fc-7b252f93800b_1.0.0.0_neutral__9pm8dksvrxpey because the current user does not have that package installed. Use Get-AppxPackage to see the list of packages installed.Camiecamila
I had to restart the computer after executing the PS command in order to solve the problem. It is a W8.1 machine.Documentation
On 8.1, restarting did not fix the problem for me. This answer should no longer be marked as correct, since it unfortunately no longer applies to the majority of cases.Donela
I can't believe that this bug is still around. It's been around since the beginning of UWP development. It's disgusting.Biyearly
P
28

There was an improvement in Windows 10 1709 to the remove-appxpackage cmdlet, adding -allusers as an option.

So, to uninstall an App for all users, this command works:

Get-AppxPackage -AllUsers [PackageFamilyName] | Remove-AppxPackage -AllUsers

Where [PackageFamilyName] is generally the GUID of your package.

Caveat / Caution: The command seems to make re-installation (re-provisioning the package using DISM) later very difficult, as it seems to treat is as if each user individually uninstalled the app. Too much to get into here...

Puryear answered 21/6, 2018 at 22:37 Comment(2)
Just FYI, this problem comes up because Windows 10 has a bug where "resetting" an app removes it but doesn't remove it properly. My app broke when I went in to the app settings and clicked Reset.Biyearly
Finally! Something that isn't an outdated answer and actually worked for me. FYI, I was running Windows 10 1809. Tried Remove-AppxPackage so many times I was pulling my hair out. Saw this answer and then added "-AllUsers" and boom, the app finally got smoked. Thank you, @zax!Rutland
N
26

My process above still works, but it simply gets around a race condition issue, where Windows Update (yes, oddly enough) is in charge of wiping out "staged packages."

According to Microsoft, the "other fix" - and I still consider this issue to be a bug - is:

Cause of the problem:

Windows Update (WU) downloads newer versions of packages you have and “stages” them as Local System, so that when you go to the store to update the apps, the update process is as quick as possible. WU will eventually clean up the staged packages that were never installed.

What are some consequences of having "Staged" packages?

  1. Staged packages prevent you from installing that particular package in development mode

  2. Staged packages eat up some disk space, but due to hardlinking, the effect of this is mitigated. If a file is identical between multiple versions of a package, appx deployment hardlinks the files instead of maintaining two separate copies of the same file.

How do I find the "Staged" packages?

  1. In an administrator powershell prompt, the command:

    get-appxpackage -all

will display all packages on the machine. For a staged package, the PackageUserInformation will show {S-1-5-18 [Unknown user]: Staged} 2. Using powershell filtering, to get the list of all staged packagefullnames, you could do:

get-appxpackage -all |% {if ($_.packageuserinformation.installstate -eq "Staged"){$_.packagefullname}}

How do I get rid of the "Staged" packages?

  1. Download psexec from sysinternals tools, written by Mark Russinovich

  2. To get rid of all of them, run in a regular admin/elevated command prompt (not powershell):

psexec -s powershell -c "get-appxpackage | remove-appxpackage"

Naughton answered 18/1, 2013 at 20:15 Comment(6)
To remove just the one package causing the problem, use I used the following line: psexec -s powershell -c "Get-AppxPackage -all | where name -eq "APP.NAME" | Remove-AppxPackage"Balling
psexec is not available for WinRT >:(Mid
Sadly this does not seem to work on Windows 8.1. When running from an Administrator command prompt, I get this error: Windows cannot remove 8eeaff03-92dd-46c9-84fc-7b252f93800b_1.0.0.0_neutral__9pm8dksvrxpey because the current user does not have that package installed. Use Get-AppxPackage to see the list of packages installed.Camiecamila
I had to restart the computer after executing the PS command in order to solve the problem. It is a W8.1 machine.Documentation
On 8.1, restarting did not fix the problem for me. This answer should no longer be marked as correct, since it unfortunately no longer applies to the majority of cases.Donela
I can't believe that this bug is still around. It's been around since the beginning of UWP development. It's disgusting.Biyearly
N
21

If that doesn't work, you can also try the following, which worked for me. Note that this is for my dev machine, not a regular user's machine, so I don't know how it would affect non-devs :-P

  1. Take ownership of the folders c:\Program Files\WindowsApps and C:\ProgramData\Microsoft\Windows\AppRepository - giving Administrator full access. Make sure TrustedInstaller also has Modify rights as well. You're also taking ownership. If you're unawares, this is done via the Properties on that folder.

  2. Go to Services and stop the Windows Installer service.

  3. Open C:\ProgramData\Microsoft\Windows\AppRepository\ and delete the PackageRepository.edb file.

  4. Start the Windows Installer service again.

  5. Launch Visual Studio as Administrator.

  6. Attempt to launch your app. It should work.

After you run the app once you should be able to run VS in user mode again.

Naughton answered 15/1, 2013 at 14:39 Comment(7)
Helped me to fix that strange issue. Had no other users on PCRickey
I have an open case with Microsoft on this. So far we've traced it to being a Visual Studio issue, since running the Powershell script to install the app works fine. I'll update this thread when we have resolution.Naughton
Just today faced this issue on another surface device. Multiple users, single device, same app for every user. Asspain.Rickey
Deleting the PackageRepository.edb prevents stuff from installing that has dependencies. It doesn't appear to rebuild the database. Even after multiple reboots, Get-AppxPackage -all returns no packages.Molybdate
Unable to stop AppXSVC in order to delete the edb file.Documentation
Do I need to do anything afterwards to return my machine to normal operation? Change ownership back, for example?Hebraism
I don't have any "PackageRepository.edb" file in that folder, only xml manifests and "StateRepository-Machine.srd" file. Tried everything that I could find online, Visual Studio still give me the same error "Invalid value for registry". Not sure what to try nowFasta
D
21

Workaround:

If nothing else works for you (for me it didnt either), you can just change your Package Name in your app manifest (just replace last few characters with another characters). When you do this, you will no longer have conflicting packages.

Changing package name may not be appropriate for some scenarios, but you can always back it up and change it back when you finished debugging on your problematic device....

Disqualify answered 14/6, 2013 at 10:35 Comment(1)
For me, this was a life-saver. I worked on this for hours one night and finally gave up. I just re-ran into this issue and, for my immediate testing purposes, this is perfect! Thank you, Hendrix!Blagoveshchensk
C
12

If you want to delete the app for the current user then try:

Get-AppxPackage | where name -eq "APP.NAME" | Remove-AppxPackage

It helped me. So there is Get-AppxPackage without -all

Chokefull answered 6/9, 2014 at 10:55 Comment(2)
Pro-ish tip: Search with -like and use wildcards to find the name: Get-AppxPackage -all | Where Name -like "*P.NA*" But very well done; thanks. Only trouble I had was where a user still couldn't uninstall a sideloaded app (though it showed up with a Get-AppxPackage) and I had to "reinstall" via the AppPackage's Add-AppDevPackage.ps1 script to get it to ultimately behave.Jot
This worked for me after doing a Get-AppxPackage -AllUsersDecomposer
I
8

On windows 10 :

First, you need an SQL database editor like SqliteBrowser3

  1. Do that manipulation as system user (use psexec or else)
  2. Make a copy of C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd
  3. Open that copy with SqliteBrowser3
  4. You will need to edit "package", "packageuser" and "user" table. To do so, you will need to note down ghost user id from "user" table and then remove them. Then, remove entries having ghost user id in user column from "packageuser" table.
  5. kill tasklist /svc /fi "services eq StateRepository"
  6. replace original StateRepository-Machine.srd after backup.
  7. reboot and then you could remove your package normally

Note : you need to leave your own user entry assigned to the package

Inoculum answered 9/11, 2015 at 7:25 Comment(4)
SqlLite Browser is unable to open the copy of StateReposity-Machine.srdCircumscissile
I figured that out.Circumscissile
I used this wonderfull tutorial to carry out the procedure. Now lets see.Circumscissile
Update table names are package, packageuser and user respectivelyCircumscissile
D
6

I had to do the following:

 get-appxpackage -all > log.txt
 notepad log.txt (search for the offending PackageFullName)
 remove-appxpackage -allusers -package "PackageFullName"

The key for me was to add the -allusers flag, since without it I received an "...because the current user does not have that package installed. Use Get-AppxPackage to see the list of packages installed." error.

Doublepark answered 4/9, 2018 at 16:8 Comment(0)
R
5

There is a set of PowerShell cmdlets for managing Windows Store apps. You can list the installed apps on the machine for all the users if you run the following command as an administrator:

Get-AppxPackage -AllUsers

I haven't found a way to uninstall an app for a different user, though. Remove-AppxPackage works only for the current user. This makes everything even more interesting if you delete a user having apps installed. At least in prerelease versions of Windows 8 this made it impossible to delete an app he had installed. I managed to successfully avoid such a situation since final release therefore I can't confirm the problem is still present, i.e. apps aren't uninstalled when a user account is deleted.

Reinstate answered 15/12, 2012 at 5:42 Comment(2)
Well, I hear there are issues when removing a user account will prevent all apps installed for that user to be removed from the list. I'm not sure if I did that, but I have an app now that I can't install on 2 out of 3 tablets I have at work because even though no user has the app installed - it still claims it is there and Get-AppxPackage -AllUsers shows it in the list. I can install it fine from the store, but not from Visual Studio. I think other apps install fine, so the problem is not with the dev license. I will check that again though the next time I look at it.Oarsman
I can confirm that even on Windows 8.1 I have found no way for uninstalling the app from already deleted account. Still investigating.Gangrene
A
3

This is similar to some other answers, especially @Pavel Nazarov's, but works for different users. And it's different from the accepted answer because you don't need to install any programs.

In Windows Powershell in admin mode, run:

get-appxpackage -all | where name -eq "{{ App Name }}" | remove-appxpackage

Abeabeam answered 30/11, 2016 at 16:42 Comment(2)
Funny you just posted it as I was looking for the answer again. :) At least on TH2 it doesn't work, unfortunately. The first time you run it - it uninstalls it for the current user, but it still remains for the other one. Then when you rerun - you get: get-appxpackage -all | where name -eq "Microsoft.WindowsSoundRecorder" | Remove-AppxPackage Remove-AppxPackage : Deployment failed with HRESULT: 0x80073CF1, Package was not found. Windows cannot remove Microsoft.WindowsSoundRecorder_10.1611.3051.0_x64__8wekyb3d8bbwe because the current user does not have that package installed. ...Oarsman
@FilipSkakun Oh bummer, you could be right - this could be a bad answer. I was running powershell as one user, but I gave it admin privileges with another user's credentials. And that admin user is the one that I was removing the app from. So that could be the source of my confusion.Abeabeam
P
3

Though this didn't work for me, it may just work for someone else...

Start powershell as Administrator and run:

Get-AppxPackage -all | Out-GridView -Passthru | Remove-AppXPackage

Then SELECT the right package and OK, hopefully it will remove.

Pothole answered 1/11, 2017 at 7:2 Comment(0)
A
2

What worked for me

 1. Close VS
 2. Open Services
 3. Stop Appx Deployment Service
 4. Open C:\ProgramData\Microsoft\Windows\AppRepository\ and delete the PackageRepository.edb file.
 5. Start Appx Deployment Service
 6. Start VS & Debug - worked like charm
Arevalo answered 29/4, 2015 at 6:44 Comment(0)
M
1

I just used get-appxpackage -all | where name -eq "PackageName" | remove-appxpackage -AllUsers on Win 10 v1903 after trying many other variations and it worked. I tested for the package's presence afterwards and it was gone.

Mindful answered 10/10, 2019 at 1:14 Comment(1)
You can really just do something like Get-AppxPackage -a *ageNam* | Remove-AppxPackage -a to remove a package based on name substring for all users without even the where part. You might still need psexec etc. to uninstall/remove files if your app is somehow stuck and only the system account is able to remove it.Oarsman
P
0

If all else fails and you are desperate, like was my case (because the user was deleted) This one is a little dangerous but it worked for me.

DO AT YOUR OWN RISK! I knew that my user was the last user created on the machine.

This answer is a combination of Auri Rahimzadeh's answer above on TAKEOWN and intika's answer where you modify the StateRepository-Machine.srd using 'DB Browser For SQLite' (downloaded here: DB Browser for SQLite 3), the only difference is I only edited one thing: In PackageUser I changed the value User 3 (Which was the ID of the previous deleted User) to 4 (Which is me, the last created User)

BE SURE TO CHECK THE User Table AND SEE WHAT VALUES WORK IN YOUR CASE!

Pothole answered 7/11, 2017 at 8:59 Comment(0)
B
0

In my case I needed to use: Get-AppxProvisionedPackage -online as opposed to Get-AppxPackage and then correspondingly use Remove-AppxProvisionedPackage -PackageName YourPackageNameHere -Online -AllUsers

Baiss answered 5/8, 2021 at 12:4 Comment(1)
I think that's for preinstalled apps that come with the OS and it should be Get-ProvisionedAppxPackage.Oarsman
S
0

This worked for me.

  1. Open Powershell as admin.
  2. Execute this command (with your package name and the user where it's installed)

Get-AppxPackage -Name "MyPackageBlah" -User "blahdy"

  1. Copy the value from PackageFullName in the output info.

Name : MyPackageBlah
Publisher : CN=BLAH
Architecture : X64
ResourceId :
Version : 1.0.34.0
PackageFullName : MyPackageBlah_1.0.34.0_x64__ww4kfnnrsedz6
IsFramework : False
PackageFamilyName : MyPackageBlah_ww4kfnnrsedz6
PublisherId : ww4kfnnrsedz6
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.UI.Xaml.2.6_2.62107.6002.0_x64__8wekyb3d8bbwe,
Microsoft.NET.Native.Framework.2.2_2.2.29512.0_x64__8wekyb3d8bbwe,
Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64__8wekyb3d8bbwe,
Microsoft.VCLibs.140.00_14.0.30035.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok

  1. Execute this command

Remove-AppxPackage -Package "MyPackageBlah_1.0.34.0_x64__ww4kfnnrsedz6" -AllUsers

You will be good now to run your app in Visual Studio.

Simpleminded answered 14/8, 2021 at 20:25 Comment(1)
You can also use Get-AppxPackage -Name "MyPackageBlah" -A to check for the app for AllUsers and Get-AppxPackage -Name "MyPackageBlah" -A | Remove-AppxPackage -A to remove it in one go. This is all basically the same as Marc's answer.Oarsman

© 2022 - 2024 — McMap. All rights reserved.