Share via

How to uninstall Microsoft Store app on a remote computer?

Webb, Mike 80 Reputation points
2026-05-18T21:34:53.7566667+00:00

I'm a Tier II tech with several tickets to uninstall Microsoft Store apps. The user's have been unresponsive to my requests for a remote session so I'm trying to find a way to use PowerShell. I've tried using the Remove-AppxPackage -Package "Package full name" but it fails. I've tried it by connecting using RDC and also trying it with Invoke-Command to remotely connect to and then uninstall it. Both ways fail; I get a message that I don't have permission. I'm using a CyberArk account that's a member of a group that is in the local admin group of all computers. What am I missing? And what works for you?

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

3 answers

Sort by: Most helpful
  1. HLBui 6,350 Reputation points Independent Advisor
    2026-05-18T23:02:08.75+00:00

    Hi Webb, Mike

    The Remove-AppxPackage cmdlet only works in the context of the logged-in user session, so if you’re trying to run it remotely or under a different account, it’ll throw those permission errors even if you’re technically an admin. That’s why RDC or Invoke-Command isn’t cutting it. The trick is that Microsoft Store apps are user-scoped, not machine-scoped, so you need to run the removal in the actual user’s context.

    What usually works is using Remove-AppxProvisionedPackage for system-wide removal, which strips the app from the image so new users don’t get it, and then pairing that with Remove-AppxPackage inside the user’s session for existing installs. If the users aren’t responsive, you can script it with PsExec or Intune/Endpoint Manager so it runs as them. CyberArk or admin accounts won’t bypass the fact that the app is tied to the user profile.

    Another option is to use Group Policy or Intune app removal policies, which are cleaner for enterprise environments. That way you don’t have to chase down individual sessions.

    So bottom line: you’re not missing permissions, you’re just fighting the user-context requirement. Use provisioned package removal for future logins, and push user-context removal via a management tool for current installs. If this clears things up, please hit “accept answer” so we know it helped and if you need more information, feel free to leave a message. We are happy to help!

    Was this answer helpful?

    1 person found this answer helpful.

  2. AI answer

    2026-05-18T21:35:07.4533333+00:00

    Remove-AppxPackage runs in the security and session context of the user whose profile owns the app. Being a local administrator on the machine is not sufficient if the app is installed only for a specific user and the command is executed in a different session.

    To remove Microsoft Store apps remotely in a supported way, use one of these approaches:

    1. Remove for all users on the device (if the app is provisioned or installed for everyone):
      • Run PowerShell in an elevated session on the target machine (or via a remote management tool that runs in the system context) and use the -AllUsers switch:
             Remove-AppxPackage -Package "<PackageFullName>" -AllUsers
        
      • This removes the specified app package from all user accounts on that device.
    2. Remove for a specific user profile:
      • Run PowerShell in the context of that user (for example, by having that user signed in and starting an elevated PowerShell in their session, or using a management tool that can impersonate that user) and then run:
             Remove-AppxPackage -Package "<PackageFullName>"
        
      • Alternatively, if you can target by user name:
             Remove-AppxPackage -Package "<PackageFullName>" -User "DOMAIN\\UserName"
        
    3. Use policy-based removal for managed fleets (recommended at scale):
      • Configure the Remove default Microsoft Store packages from the system policy via:
        • Group Policy: Computer Configuration > Administrative Templates > Windows Components > App Package Deployment > Remove Default Microsoft Store packages from the system.
        • Intune: Settings catalog policy with the same setting under Administrative Templates\Windows Components\App Package Deployment.
      • For additional apps, add their Package Family Names (PFNs) to the policy:
             Get-AppxPackage *AppName* | Select-Object PackageFamilyName
        
      • The policy applies at user provisioning or sign-in and removes the targeted apps without needing an interactive remote session.

    If Invoke-Command fails with a permissions error despite local admin membership, the issue is typically that the command is not running in the target user’s session or that the app is user-scoped only. Using -AllUsers from an elevated/system context or applying a device-level policy avoids that limitation.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

    1 person found this answer helpful.
  3. Webb, Mike 80 Reputation points
    2026-05-21T13:00:29.8633333+00:00

    I worked with CoPilot with what I needed and your input to this post to come up with something and this worked. Look it over to see if it can be further improved:

    $script = @"

    $pkg=',FullPackageName> Remove-AppxPackage -Package $pkg -AllUsers -ErrorAction SilentlyContinue

    Remove-AppxProvisionedPackage -Online -PackageName $pkg -ErrorAction SilentlyContinue

    Start-Sleep -Seconds 2

    if (-not (Get-AppxPackage -AllUsers | Where-Object PackageFullName -eq $pkg)) {

        Write-Output 'SUCCESS: Package removed'

        exit 0

    } else {

        Write-Output 'FAIL: Package still present'

        exit 1

    }

    "@

     

    .\psexec.exe \<RemoteComputerName> -s powershell.exe -ExecutionPolicy Bypass -Command $script

     

     

    .\psexec.exe \<RemoteComputerName> -s powershell.exe -ExecutionPolicy Bypass -Command "Get-AppxPackage -AllUsers | Where-Object Name -like 'python'"

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.