To resolve the "Access Denied" error when trying to run the Remove-AppxPackage command in PowerShell, ensure that you are running PowerShell with elevated permissions (as an administrator). Here are some steps you can follow:
- Run PowerShell as Administrator:
- Right-click on the Start menu or press
Win + X. - Select Windows PowerShell (Admin) or Windows Terminal (Admin).
- If prompted by User Account Control, click Yes to allow.
- Right-click on the Start menu or press
- Check User Permissions: Ensure that your user account has administrative privileges. If you are not an administrator, you will need to log in with an account that has these permissions.
- Use the Correct Command: Make sure you are using the correct command syntax. The command you provided seems correct, but ensure there are no typos.
- Check for NonRemovable Apps: Some apps cannot be removed if they are marked as non-removable. You can check this by running:
If theGet-AppxPackage -Name Microsoft.YourPhone | Select-Object -Property Name, NonRemovableNonRemovableproperty is set toTrue, you will not be able to remove it. - Try Removing for Current User: If you are still facing issues, try removing the app only for the current user:
Get-AppxPackage Microsoft.YourPhone | Remove-AppxPackage
If you follow these steps and still encounter issues, it may be helpful to check if any security software is blocking the command or if there are group policies in place that restrict app removals.
References: