Add-AppxPackage

Add-AppxPackage is accessible with the help of Appx module. To configure Appx, go through this link.

Synopsis

Adds a signed app package to a user account.

Description

The Add-AppxPackage cmdlet adds a signed app package to a user account. An app package has an .appx file name extension. 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.

Parameters

-AppInstallerFile

Runs an appinstaller file and allows the user to install all of the defined packages with a single click. For more information, see Create an App Installer file manually.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

-DependencyPackages

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

Type:String[]
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

-DependencyPath

Specifies an array of file paths of dependency packages that are required for the installation of the app package. The app package has an .msix, .appx, .msixbundle, or .appxbundle file name extension. You can specify the paths to more than one dependency package. If a package is already installed for a user, you can skip adding it to the DependencyPath.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-DisableDevelopmentMode

Indicates that this cmdlet registers an existing app package installation that has been disabled, did not register, or has become corrupted. Use the current parameter 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 API has staged. Use the Register parameter to specify the location of the app package manifest .xml file from the installation location.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-ExternalPackages

Specifies an array of optional packages that must be installed along with the app package. It is an atomic operation which means that if the app or its optional packages fail to install, the deployment operation will be aborted

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-ForceApplicationShutdown

Indicates that this cmdlet forces all active processes that are associated with the package or its dependencies to shut down. If you specify this parameter, do not specify the ForceTargetApplicationShutdown parameter.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-ForceTargetApplicationShutdown

Indicates that this cmdlet forces all active processes that are associated with the package to shut down. If you specify this parameter, do not specify the ForceApplicationShutdown parameter.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-ForceUpdateFromAnyVersion

This parameter is used to force a specific version of a package to be staged/registered, regardless of whether a higher version is already staged/registered.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-InstallAllResources

Indicates that this cmdlet forces 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 parameter can only be used when specifying a resource bundle or resource bundle manifest.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-LimitToExistingPackages

This parameter is used to prevent missing referenced packages to be downloaded.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-MainPackage

Specifies the main package full name or bundle full name to register.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

-OptionalPackages

Specifies the PackageFamilyName of the optional packages that are in a related set that need to be installed along with the app. Unlike the external packages flag, you do not need to pass in a path to the optional package(s). It is an atomic operation which means that if the app or its optional packages fail to install, the deployment operation will be aborted

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Path

Specifies the file path of the app package. An app package has an .msix, .appx, .msixbundle, or .appxbundle file name extension.

Type:String
Aliases:PSPath
Position:1
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

-Register

Indicates that this cmdlet registers an application in development mode. You can use development mode to install applications from a folder of unpackaged files. You can use the current parameter to test your Windows® Store apps before you deploy them as app packages. To register an existing app package installation, you must specify the DisableDevelopmentMode parameter and the Register parameter. In order to specify dependency packages, specify the DependencyPath parameter and the DisableDevelopmentMode parameter.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-RegisterByFamilyName

Specifies the parameter -MainPackage that defines the family name or full name to be registered.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-RelatedPackages

This is an optional element that is used to specify the other optional packages that are specified in the main app package. These packages will not be installed as part of the deployment operation.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-RequiredContentGroupOnly

Specifies that only the required content group that is specified in the AppxContentGroupMap.xml must be installed. At this point the app can be launched. Calling add-appxpackage specifying the path to the app, triggers the rest of the app to be installed in the order defined in the AppxContentGroupMap.xml.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-RetainFilesOnFailure

In the case of a failed deployment, if this switch is set to $true, files that have been created on the target machine during the installation process are not removed.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Stage

Stages a package to the system without registering it.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-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 this parameter, the package being added is a primary package and is not 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.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Volume

Specifies the AppxVolume object to which to stage the package. The volume also specifies the default location for user AppData.

Type:AppxVolume
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Syntax

Add-AppxPackage [-Path] <String> [-DependencyPath <String[]>] [-RequiredContentGroupOnly] [-ForceApplicationShutdown] [-ForceTargetApplicationShutdown] [-ForceUpdateFromAnyVersion] [-RetainFilesOnFailure] [-InstallAllResources] [-Volume <AppxVolume>] [-ExternalPackages <String[]>] [-OptionalPackages <String[]>] [-RelatedPackages <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Add-AppxPackage [-Path] <String> [-RequiredContentGroupOnly] [-AppInstallerFile] [-ForceTargetApplicationShutdown] [-InstallAllResources] [-LimitToExistingPackages] [-Volume <AppxVolume>] [-WhatIf] [-Confirm] [<CommonParameters>]

Add-AppxPackage [-Path] <String> [-DependencyPath <String[]>] [-Register] [-DisableDevelopmentMode] [-ForceApplicationShutdown] [-ForceTargetApplicationShutdown] [-ForceUpdateFromAnyVersion] [-InstallAllResources] [-WhatIf] [-Confirm] [<CommonParameters>]

Add-AppxPackage [-Path] <String> [-DependencyPath <String[]>] [-RequiredContentGroupOnly] [-ForceApplicationShutdown] [-ForceTargetApplicationShutdown] [-ForceUpdateFromAnyVersion] [-RetainFilesOnFailure] [-InstallAllResources] [-Update] [-WhatIf] [-Confirm] [<CommonParameters>]

Add-AppxPackage [-Path] <String> [-DependencyPath <String[]>] [-RequiredContentGroupOnly] [-Stage] [-ForceUpdateFromAnyVersion] [-Volume <AppxVolume>] [-ExternalPackages <String[]>] [-OptionalPackages <String[]>] [-RelatedPackages <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Add-AppxPackage [-Register] -MainPackage <String> [-DependencyPackages <String[]>] [-ForceApplicationShutdown] [-ForceTargetApplicationShutdown] [-ForceUpdateFromAnyVersion] [-InstallAllResources] [-WhatIf] [-Confirm] [<CommonParameters>]

Add-AppxPackage [-RegisterByFamilyName] -MainPackage <String> [-DependencyPackages <String[]>] [-ForceApplicationShutdown] [-ForceTargetApplicationShutdown] [-InstallAllResources] [-OptionalPackages <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

—————-Example 1—————-
Add an app package
PS C:> Add-AppxPackage -Path “C:\Users\RaviS\Desktop\XApp.appx” -DependencyPath “C:\Users\RaviS\Desktop\winjs.appx”
This command adds an app package that the package contains.

—————-Example 2—————-
Add a disabled app package in development mode
PS C:> $ManifestPath = (Get-AppxPackage -Name “WindowsCalculator“).InstallLocation + “\Appxmanifest.xml”
PS C:> Add-AppxPackage -Path $ManifestPath -Register -DisableDevelopmentMode
This command gets the full path of the package manifest file of an installed Windows Store app, and then registers 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.

—————-Example 3—————-
Add an app along with its optional packages
PS C:> Add-AppxPackage -Path “C:\Users\RaviS\Desktop\XApp.appxbundle” -ExternalPackages “C:\Users\RaviS\Desktop\optionalpackage1.appx”,”C:\Users\RaviS\Desktop\optionalpackage2.appxbundle”
PS C:> Add-AppxPackage -Path “C:\Users\RaviS\Desktop\XApp.appxbundle” -OptionalPackages “143package.OptionalPackage1”
This command adds an app package along with its optional packages. It is an atomic operation which means that if the app or its optional packages fail to install, the deployment operation will be aborted

—————-Example 4—————-
Install only the required section of a streaming app
PS C:> Add-AppxPackage -Path “C:\Users\RaviS\Desktop\MyApp.appxbundle” -RequiredContentGroupOnly
This command adds an app package but only installs the required section of a streaming app. Calling this command again without the RequiredContentGroupOnly flag proceeds to install the rest of the application in the order defined by the AppxContentGroupMap.xml

You can check the Version, CommandType and Source of this cmdlet by giving below command.

Get-Command Add-AppxPackage

Get-Command Add-AppxPackage powershell script command cmdlet appx

You can also read about

  • Get-AppxPackage
  • Get-AppxPackageManifest
  • Move-AppxPackage
  • Remove-AppxPackage

To know more PowerShell cmdlets(Commands) on Appx click here

Click on this Link for an Single place where you get all the PowerShell cmdlet sorted based on the modules.

You can also refer other blogs on PowerShell at link

You can also refer other blogs on Microsoft at link

And also if you required any technology you want to learn, let us know below we will publish them in our site http://tossolution.com/

Like our page in Facebook and follow us for New technical information.

References are taken from Microsoft

2 Replies to “Add-AppxPackage”

  1. Please keep on posting such quality storys as this is a rare thing to find these days. I am always searching online for articles that can help me. watching forward to another great blog. Good luck to the author! all the best!

Leave a Reply

Your email address will not be published. Required fields are marked *