Add-AppxPackage

Remove an app package from a user account.

Syntax
      Add-AppxPackage [-Path] String 
          [-DependencyPath String[]] [-Register]
            [-DisableDevelopmentMode] [-ForceApplicationShutdown]
               [-InstallAllResources]
                  [-Confirm] [-WhatIf] [CommonParameters]

      Add-AppxPackage [-Path] String 
        -MainPackage String  [-DependencyPackages String[]] [-Register]
           [-InstallAllResources]
              [-Confirm] [-WhatIf] [CommonParameters]

      Add-AppxPackage [-Path] String [-Update]
         [-DependencyPath String[]]
            [-ForceApplicationShutdown]
               [-InstallAllResources]
                  [-Confirm] [-WhatIf] [CommonParameters]

Key
   -Package String
       An AppxPackage object or the full name of the package to be removed.
        
   -PreserveApplicationData
       Preserve the application data during package removal.
       The application data is available for later use.
        
   -Confirm
       Prompt for confirmation before running the cmdlet.

   -DependencyPackages
       Specifies the dependency package full name or dependency package bundle full name to be registered.

   -DependencyPath
       Specifies the file path of a dependency package that’s required for the installation of the
       app package (.appx or .appxbundle). You can specify the paths to more than one dependency package.

   -DisableDevelopmentMode
       Register an existing app package (.appx or .appxbundle) installation that has been disabled, didn’t
       register, or has become corrupted.
       Use DisableDevelopmentMode to specify that the manifest is from an existing installation and not
       from a collection of files in development mode. You can also use this parameter to register an
       application that the Package Manager APIhttp://go.microsoft.com/fwlink/?LinkId=245447 has staged.
       Use the -Register parameter to specify the location of the app package manifest .xml file from
       the installation location.

   -ForceApplicationShutdown
       Force all active processes that are associated with the package or its dependencies to shut down.

   -InstallAllResources
       Force the deployment of all resource packages specified from a bundle argument.
       This overrides the resource applicability check of the deployment engine and forces staging of all
       resource packages, registration of all resource packages, or staging and registration of all resource
       packages. This flag can only be used when specifying a resource bundle or resource bundle manifest.

   -MainPackage
       Specifies the main package full name or bundle full name to be registered.

   -Path
       Specifies the file path of the app package (.appx or .appxbundle).

   -Register
       Registers an application in development mode. You can use development mode to install applications
       from a folder of unpackaged files. You can use the Register parameter to test your Windows Store
       apps before you deploy them as app packages (.appx).
       To register an existing app package (.appx) installation, you must specify the -DisableDevelopmentMode
       parameter along with -Register.
       In order to specify dependency packages, specify the -DependencyPath parameter and the
       -DisableDevelopmentMode parameter.

   -Update
       Specifies that the package being added is a dependency package update.
       A dependency package is removed from the user account when the parent app is removed.
       If you do not use -Update, the package being added will be flagged as a primary package and will not
       be removed from the user account if the parent app is removed.
       To update an already installed package, the new package must have the same package family name.

   -WhatIf
       Shows what would happen if the cmdlet runs. The cmdlet is not run.

Add-AppxPackage adds a signed app package (.appx) to a user account. Use the -DependencyPath parameter to add all other packages that are required for the installation of the app package. You can use the -Register parameter to install from a folder of unpackaged files during development of Windows Store apps. To update an already installed package, the new package must have the same package family name.

This cmdlet was introduced in Windows PowerShell 5.0.

Examples

Add the app package named MyApp.appx:

PS C:\> Add-AppxPackage -Path C:\Users\user1\Desktop\MyApp.appx -DependencyPath C:\Users\user64\Desktop\winjs.appx

Get the full path of the package manifest file of an installed Windows Store app, and then register that package. You can use -DisableDevelopmentMode to register an application that is staged by the StagePackageAsync API, has been disabled, or has become corrupted during testing

PS C:\> $manifestpath = (get-appxpackage -Name "*WindowsCalculator*").InstallLocation + "\Appxmanifest.xml"
PS C:\> Add-AppxPackage -register $manifestpath -DisableDevelopmentMode

“No law can give power to private persons; every law transfers power from private persons to government” ~ Isabel Paterson

Related PowerShell Cmdlets

Get-AppXPackage - List the app packages installed in a user profile.
Remove-AppxPackage - Remove an app package from a user account.


 
Copyright © 1999-2024 SS64.com
Some rights reserved