question

StevenSkovran-9017 avatar image
0 Votes"
StevenSkovran-9017 asked pgasser commented

Removing a staged app from Windows 10

Is there any way to remove an app that has been staged by the "SYSTEM" user?

I am using VS2019 to develop a UWP app (I'll call it TestApp for this post) that will be sideloaded for internal company use.

I am completely blocked the following error in Visual Studio when I try to test my app:
DEP0700: Registration of the app failed. [0x80073CFB] Another user has already installed a packaged version of this app. An unpackaged version cannot replace this.

The app does not appear in the System Settings > Apps list to be removed.
There are no other actual user accounts on my development machine.

Looking at my apps view powershell, I see that the "SYSTEM" user has a staged version of the app.

> Get-AppxPackage -AllUsers TestApp

Name : TestApp
Publisher : OU=Test
Architecture : X64
ResourceId : Version : 1.0.0.0
PackageFullName : TestApp_1.0.0.0_x64__blah
InstallLocation : C:\Program Files\WindowsApps\TestApp_1.0.0.0_x64__blah
IsFramework : False
PackageFamilyName : TestApp__blah
PublisherId : blah
PackageUserInformation : {S-1-5-18 [NT AUTHORITY\SYSTEM]: Staged}
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok


I have tried to remove the app using:
Get-AppXPackage -AllUsers TestApp | Remove-AppXPackage -AllUsers

That does not give an error but does not remove the package.

I have tried the psexec -i -s -d powershell.exe route in order to run the commands as the "SYSTEM" user.
I have verified that I am the SYSTEM user in this shell by running whoami.

> whoami
nt authority\system


I have tried removing all the package types at the same time:
Get-AppxPackage -AllUsers TestApp -PackageTypeFilter Bundle, Main, Resource | Remove-AppxPackage -AllUsers

I have tried removing from -AllUsers and the specific -User S-1-5-18 using the SID of the "SYSTEM" user.

Nothing works.

I have spent the better part of this entire day reading posts going back about 7 years describing variations of this issue.
It seems the failure to remove "Staged" apps is the latest manifestation.
I have seen bug reports in the Visual Studio community getting punted to the Operating System community (since this is a package manager issue) but not actually answered.

So... is there any way to actually remove an app that has been staged by the "SYSTEM" user?

Thank you for your help!

windows-uwp
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Based on your scenario, I'd suggest you check whether you are running the PowerShell as administrator first.

If this does not work, you could also try to login with that specific account and manually uninstall the app from the Start Menu.

There is another way that you could test your app without removing the package. You just need to create a new test certificate in the package manifest file so the system will consider it as a new app.

If you want to know why the PowerShell does not work with the remove command, you could ask a new question with the Windows-10-general tag.

0 Votes 0 ·

Thank you for the reply.

I do know that I was running PowerShell as administrator.
In addition to seeing "Administrator" in the title bar, I used net session and checked the response in the terminal.
Is there a better more explicit way to check if a shell is running as administrator?

Using psexec allowed me to open a terminal as the SYSTEM user (verified with whoami).

How would I login as the "NT AUTHORITY\SYSTEM" user and manually uninstall the app from the Start Menu?

Using a self-signed dummy certificate did trick the system into thinking it was a different app - thank you for the suggestion.

0 Votes 0 ·
RoyLi-MSFT avatar image RoyLi-MSFT StevenSkovran-9017 ·

How would I login as the "NT AUTHORITY\SYSTEM" user and manually uninstall the app from the Start Menu?

For login as the "NT AUTHORITY\SYSTEM" user , you might need to ask a new question with the Windows-10-general tag. When you've logged in as the "NT AUTHORITY\SYSTEM" user(if it is possible), then you just need to open the Start Menu, find the test app and right-click on it, choose uninstall it.

0 Votes 0 ·

I'm seeing the exact same problem. Could you further explain the trick with the dummy cert? I would really really appreciate it!

0 Votes 0 ·

0 Answers