Score:0

Powershell - Status "Installed(pending removal)" when running Remove-Appxpackage

in flag

I'm developing application uninstaller using Powershell. I using 2 commands:

  1. Uninstall for all users (using -AllUser): Get-AppxPackage -AllUsers <PackageName> | Remove-AppxPackage -AllUsers

  2. Uninstall specified user: Remove-AppxPackage <PackageName> -User <User SID>

Both commands I run using user admin.

Command 1. works fine. Command 2. doesn't work as expected.

Details about Command 2.

After I run 2/, I use command Get-AppxPackage <PackageName> -AllUsers to check app installation status. The specified user's "PackageUserInformation" is [Installed(pending removal)]. Like the picture below. (Due to some security reasons, I cannot upload detailed images. I will add pictures later.)

I have tested on 2 environments:

  • A) Windows 10 Pro 1909 => Uninstall successfully only when I sign in that specified user
  • B) Windows 10 Pro 2004 => Uninstall successfully when I run command 2. and wait about 15 minutes (success includes method A)

I have the following questions:

  1. In case A, Why do I have to sign in again to be able to uninstall?

  2. In case B, Why do I have to wait 15 minutes until the uninstall is complete?

  3. What is a difference between the two versions of Windows? Is there an update to this issue?

I think this problem has to do with User's state (Active or Disconnected) and user's permission to access C:\Program Files\WindowsApps. But I still can't find any documents related to this issue.

Because when using command 1. (Uninstall for All users) this problem does not occur.

If possible, please help me. I greatly appreciate your support. Thank you.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.