Forum Discussion
-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.MicrosoftSolitaireCollection_4.16.3140.0_x64__8wekyb3d8bbwe' will give me the error:
PS C:\Users\xyz> Remove-AppxPackage -Allusers -PackageName 'Microsoft.MicrosoftSolitaireCollection_4.16.3140.0_x64__8wekyb3d8bbwe'
Remove-AppxPackage : A parameter cannot be found that matches parameter name 'PackageName'.
At line:1 char:30
+ Remove-AppxPackage -Allusers -PackageName 'Microsoft.MicrosoftSolitai ...
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-AppxPackage], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Windows.Appx.PackageManager.Commands.RemoveApp
xPackageCommand
Of course, it works without -AllUsers but it won't remove from the user I'm trying to remove.
Could you please advise what needs to be done to make an admin or domain admin user remove the Apps for -AllUsers on the computer?
Thank you.
- LeonPavesicSilver Contributor
Hi paobmmc,
The error you encountered is (in my opinion) because the "Remove-AppxPackage" command does not have a parameter called "PackageName." To remove the Microsoft Solitaire Collection app package from all user accounts on your computer, you could try use a different workaround.
Get-AppxPackage -AllUsers *MicrosoftSolitaireCollection* | Remove-AppxPackageThis command will find the Microsoft Solitaire Collection app package for all users on the computer and then it should remove it.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
- paobmmcCopper ContributorHi, 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>- LeonPavesicSilver 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-AppxPackageIf you continue to encounter issues, you can maybe try this:
Get-AppxProvisionedPackage -Online | where DisplayName -eq "Microsoft Solitaire Collection" | Remove-AppxProvisionedPackage -OnlineHope it helps!
Kindest regards
Leon