Create Packages using PowerShell

Use the PowerShell snap-in to automate the creation and deployment of single or multiple artifact packages from source environments to target environments. This is especially useful where you need to make regular or frequent package creation or deployments, or where script-based installations and updates are preferred. See Deploy Packages Using PowerShell for more information about deploying Packages using PowerShell.

  • PowerShell package creation uses namespaces. For a detailed explanation, see the Important Considerations section below.
  • This method is not faster than creating a package using Package and Deployment, as all the validation and dependency checking is still done through the API. However, it can be scripted or scheduled to run without human intervention.
  • SharePoint items can be packaged using PowerShell, however, you cannot deploy packages containing SharePoint artifacts with the Powershell snap-in, you must use Package and Deployment.

Prerequisites

Microsoft Management Console (MMC) 3.0 or later, and Microsoft PowerShell 3.0 or later, are prerequisites for Package and Deployment. MMC 3.0 and PowerShell 3.0 are components of the Windows Management Framework 3.0 package, available at https://www.microsoft.com/en-us/download/details.aspx?id=34595.

Quick steps

The following high-level steps outline how you use PowerShell creation:

  1. Create a package using Package and Deployment.
  2. Open PowerShell. Add the Package and Deployment snap-in.
  3. Run the Write-PackageConfig command to create the package creation configuration *.XML file for the package file generated in step 1.
  4. Edit the package creation configuration file to customize the settings for the specific package.
  5. Run the New-Package command to create the package.