Forum Discussion
paobmmc
Jul 26, 2023Copper Contributor
-AllUsers won't work as an admin (Get-AppxPackage or Remove-AppxPackage)
Hi, I'm trying to remove some Apps from Win10 and 11 systems from a PS prompt as local admin for domain users. Using for instance: Remove-AppxPackage -Allusers -PackageName 'Microsoft.Micro...
paobmmc
Jul 26, 2023Copper Contributor
Hi, thank you for the reply
Although it didn't work, I'm still getting the same error.
PS C:\Users\xyz> Get-AppxPackage -AllUsers *MicrosoftSolitaireCollection* | Remove-AppxPackage
Get-AppxPackage : Access is denied.
Access is denied.
It works fine without -AllUsers though.
PS C:\Users\xyz> Get-AppxPackage *MicrosoftSolitaireCollection* | Remove-AppxPackage
PS C:\Users\xyz>
Although it didn't work, I'm still getting the same error.
PS C:\Users\xyz> Get-AppxPackage -AllUsers *MicrosoftSolitaireCollection* | Remove-AppxPackage
Get-AppxPackage : Access is denied.
Access is denied.
It works fine without -AllUsers though.
PS C:\Users\xyz> Get-AppxPackage *MicrosoftSolitaireCollection* | Remove-AppxPackage
PS C:\Users\xyz>
LeonPavesic
Jul 26, 2023Silver Contributor
Hi paobmmc,
thanks for the update.
Hmmm, the "Access is denied" error typically occurs when you try to remove the app package for all users without the necessary administrative privileges. When using the "-AllUsers" parameter with the "Get-AppxPackage" cmdlet, it requires elevated privileges. Are you sure you are doing that?
The last idea I have is to:
2. Run the Command with Elevated Privileges in PowerShell:
Get-AppxPackage -AllUsers *MicrosoftSolitaireCollection* | Remove-AppxPackage
If you continue to encounter issues, you can maybe try this:
Get-AppxProvisionedPackage -Online | where DisplayName -eq "Microsoft Solitaire Collection" | Remove-AppxProvisionedPackage -Online
Hope it helps!
Kindest regards
Leon