How do I use Add-AppxPackage to install a Provisioned Package that has already been installed using Add-AppxProvisionedPackage

Howard Lam 21 Reputation points
2021-09-05T06:12:20.683+00:00

As title, how do I use Add-AppxPackage to install a Provisioned Package that has already been installed using Add-AppxProvisionedPackage?

Get-AppxProvisionedPackage lists the name of the package I want but I have no idea how to get it installed for a user.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,429 questions
{count} votes

Accepted answer
  1. metablaster 91 Reputation points
    2021-09-05T15:08:44.583+00:00

    Here is one solution that should work:

    1. Open Settings App in Start -> Settings
    2. Click on "Update & Security"
    3. Click on "For developers"
    4. Enter admin username and password if asked
    5. Under "File Explorer" enable "Change policy to show Run as different user in start"
    6. Click apply
    7. Click on Start button then -> Expand Windows PowerShell folder
    8. Right click on "Windows PowerShell" then select "More" and "Run as Different user"
    9. When asked enter credentials of the target user to which you want to install provisioned package

    PowerShell console of the target user opens... and you execute commands...

    At this point you first need to know the DisplayName property of the target provisioned package that you want to install,
    to learn this information we need to open additional PowerShell console as Administrator then run:

    Get-AppxProvisionedPackage -Online
    

    In the output see what is the package "DisplayName" you want to install then modify $Name variable below accordingly,
    in this example we are using "Microsoft.YourPhone" but you probably want to install something else to the target user.

    First close down Administrator console and run updated "Name" command as follows in target user console that we opened before:

    $Name = "Microsoft.YourPhone"
    

    Type $Name into the console and press enter to verify variable is not empty:

    $Name
    

    After you initialized the $Name variable run following:

    $Manifest = Get-AppxProvisionedPackage -Online | Where-Object -Property DisplayName -EQ $Name  | Select-Object -ExpandProperty InstallLocation
    

    Type $Manifest into the console and press enter to verify variable is not empty:

    $Manifest
    

    Following command installs the package for target user:

    Add-AppxPackage -Path $Manifest -Register -DisableDevelopmentMode
    

    When you're done type exit to close PowerShell and test if the package was installed for the target user.
    If you get any kind of error let me know in comment below.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Limitless Technology 39,461 Reputation points
    2021-09-06T10:26:04.31+00:00

    Hello,

    I could give you an example hot to to reinstall and re-register specific app for the current account:

    Open command prompt

    PowerShell -ExecutionPolicy Unrestricted -Command "& {$manifest = (Get-AppxPackage Office.OneNote).InstallLocation + '\AppxManifest.xml' ; Add-AppxPackage -DisableDevelopmentMode -Register $manifest}"

    *the axample shows hot to re-register One Note.

    You can alos ro reinstall and re-register All Apps for the current account only

    Get-AppXPackage | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

    Hope this helps!

    1 person found this answer helpful.
    0 comments No comments