PowerShell Commands

Install-Package

Install-Package [-AdditionalArguments <String[]>] [-AllVersions] [-Confirm] [-Credential <PSCredential>] [-Force][-ForceBootstrap] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-WhatIf] [<CommonParameters>]
Install-Package [-AdditionalArguments <String[]>] [-AllVersions] [-Confirm] [-Credential <PSCredential>] [-Force][-ForceBootstrap] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-WhatIf] [<CommonParameters>]
Install-Package [-AllVersions] [-AllowClobber] [-Command <String[]>] [-Confirm] [-Credential <PSCredential>][-DscResource <String[]>] [-Filter <String>] [-Force] [-ForceBootstrap] [-Includes {DscResource | Cmdlet |Function | Workflow | RoleCapability}] [-InstallUpdate] [-NoPathUpdate] [-PackageManagementProvider <String>][-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-PublishLocation <String>] [-RoleCapability <String[]>] [-Scope{CurrentUser | AllUsers}] [-ScriptPublishLocation <String>] [-ScriptSourceLocation <String>] [-SkipPublisherCheck][-Tag <String[]>] [-Type {Module | Script | All}] [-WhatIf] [<CommonParameters>]
Install-Package [-AllVersions] [-AllowClobber] [-Command <String[]>] [-Confirm] [-Credential <PSCredential>][-DscResource <String[]>] [-Filter <String>] [-Force] [-ForceBootstrap] [-Includes {DscResource | Cmdlet |Function | Workflow | RoleCapability}] [-InstallUpdate] [-NoPathUpdate] [-PackageManagementProvider <String>][-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-PublishLocation <String>] [-RoleCapability <String[]>] [-Scope{CurrentUser | AllUsers}] [-ScriptPublishLocation <String>] [-ScriptSourceLocation <String>] [-SkipPublisherCheck][-Tag <String[]>] [-Type {Module | Script | All}] [-WhatIf] [<CommonParameters>]
Install-Package [-AllVersions] [-AllowPrereleaseVersions] [-ConfigFile <String>] [-Confirm] [-Contains <String>][-Credential <PSCredential>] [-Destination <String>] [-ExcludeVersion] [-FilterOnTag <String[]>] [-Force][-ForceBootstrap] [-Headers <String[]>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Scope {CurrentUser |AllUsers}] [-SkipDependencies] [-SkipValidate] [-WhatIf] [<CommonParameters>]
Install-Package [-AllVersions] [-AllowPrereleaseVersions] [-ConfigFile <String>] [-Confirm] [-Contains <String>][-Credential <PSCredential>] [-Destination <String>] [-ExcludeVersion] [-FilterOnTag <String[]>] [-Force][-ForceBootstrap] [-Headers <String[]>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Scope {CurrentUser |AllUsers}] [-SkipDependencies] [-SkipValidate] [-WhatIf] [<CommonParameters>]
Install-Package [-AllVersions] [-Confirm] [-Credential <PSCredential>] [-Force] [-ForceBootstrap][-IncludeSystemComponent] [-IncludeWindowsInstaller] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-WhatIf][<CommonParameters>]
Install-Package [-AllVersions] [-Confirm] [-Credential <PSCredential>] [-Force] [-ForceBootstrap][-IncludeSystemComponent] [-IncludeWindowsInstaller] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-WhatIf][<CommonParameters>]
Install-Package [-InputObject*] <SoftwareIdentity[]> [-AllVersions] [-Confirm] [-Credential <PSCredential>][-Force] [-ForceBootstrap] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-WhatIf] [<CommonParameters>]
Install-Package [-Name*] <String[]> [-AllVersions] [-Confirm] [-Credential <PSCredential>] [-Force][-ForceBootstrap] [-MaximumVersion <String>] [-MinimumVersion <String>] [-ProviderName {msi | NuGet | msu |Programs | PowerShellGet | psl | chocolatey}] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-RequiredVersion<String>] [-Source <String[]>] [-WhatIf] [<CommonParameters>]

The Install-Package cmdlet installs one or more software packages on the local computer.

Parameters

-AdditionalArguments <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies one or more additional arguments for installation.

-AllVersions [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet installs all available versions of the package. By default, Install -Package only installs the newest available version.

-AllowClobber [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

@{Text=}

-AllowPrereleaseVersions [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill AllowPrereleaseVersions Description}}

-Command <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies one or more commands for which Find-Package searches.

-ConfigFile <String>

  • Default value is None
  • Accepts pipeline input False

{{Fill ConfigFile Description}}

-Confirm [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Prompts you for confirmation before running the cmdlet.

-Contains <String>

  • Default value is None
  • Accepts pipeline input False

{{Fill Contains Description}}

-Credential <PSCredential>

  • Default value is None
  • Accepts pipeline input False

Specifies a user account that has rights to install a package for a specified package provider or source.

-Destination <String>

  • Default value is None
  • Accepts pipeline input False

{{Fill Destination Description}}

-DscResource <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies one or more Desired State Configuration (DSC) resources for which Find-Package searches.

-ExcludeVersion [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill ExcludeVersion Description}}

-Filter <String>

  • Default value is None
  • Accepts pipeline input False

Specifies terms to search for within the Name and Description properties.

-FilterOnTag <String[]>

  • Default value is None
  • Accepts pipeline input False

{{Fill FilterOnTag Description}}

-Force [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet overrides restrictions that prevent the command from succeeding, as long as the changes do not compromise security.

-ForceBootstrap [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Forces PackageManagement to automatically install the package provider for the specified package.

-Headers <String[]>

  • Default value is None
  • Accepts pipeline input False

{{Fill Headers Description}}

-IncludeSystemComponent [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet includes system components in the results.

-IncludeWindowsInstaller [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet includes the Windows installer in the results.

-Includes <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies whether Find-Package should find all packages with DSC resources, cmdlets, functions, or workflows. The acceptable values for this parameter are:

- Cmdlet

- DscResource

- Function

- Workflow

-InputObject <SoftwareIdentity[]>

  • This value is required
  • Default value is None
  • Accepts pipeline input ByValue

Specifies a package by using the package's SoftwareIdentity type, which is shown in the results of the Find-Package cmdlet.

-InstallUpdate [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Indicates that this cmdlet installs updates.

-MaximumVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the maximum allowed version of the package that you want to find. If you do not specify this parameter, Install-Package installs the finds the highest-numbered available version of the package.

-MinimumVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the minimum allowed version of the package that you want to find. If you do not add this parameter, Install-Package finds the highest available version of the package that also satisfies any maximum specified version specified by the MaximumVersion parameter.

-Name <String[]>

  • This value is required
  • Default value is None
  • Accepts pipeline input False

Specifies one or more package names. Multiple names must be separated by commas.

-NoPathUpdate [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

@{Text=}

-PackageManagementProvider <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the name of the Package Management provider.

-ProviderName <String[]>

  • Default value is None
  • Accepts pipeline input ByPropertyName

Specifies one or more package provider names to which to scope your package search. You can get package provider names by running the Get-PackageProvider cmdlet.

-Proxy <Uri>

  • Default value is None
  • Accepts pipeline input False

@{Text=}

-ProxyCredential <PSCredential>

  • Default value is None
  • Accepts pipeline input False

@{Text=}

-PublishLocation <String>

  • Default value is None
  • Accepts pipeline input False

Specifies a location for publishing the package.

-RequiredVersion <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the exact allowed version of the package that you want to install. If you do not add this parameter, Install-Package installs the newest available version of the package that also satisfies any maximum version specified by the MaximumVersion parameter.

-RoleCapability <String[]>

  • Default value is None
  • Accepts pipeline input False

@{Text=}

-Scope <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the scope to which to install the package. The acceptable values for this parameter are:

- CurrentUser

- AllUsers

-ScriptPublishLocation <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the script publish location.

-ScriptSourceLocation <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the script source location.

-SkipDependencies [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill SkipDependencies Description}}

-SkipPublisherCheck [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

@{Text=}

-SkipValidate [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

{{Fill SkipValidate Description}}

-Source <String[]>

  • Default value is None
  • Accepts pipeline input ByPropertyName

Specifies one or more package sources. Multiple package source names must be separated by commas. You can get package source names by running the Get-PackageSource cmdlet.

-Tag <String[]>

  • Default value is None
  • Accepts pipeline input False

Specifies one or more strings to search for in the package metadata.

-Type <String>

  • Default value is None
  • Accepts pipeline input False

Specifies whether to search for packages with a module, a script, or both. The acceptable values for this parameter are:

- Module

- Script

- All

-WhatIf [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

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

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Outputs
SoftwareIdentity[]
Examples
  1. Install a package by package name:
    PS C:\> Install-Package -Name "DSCAccelerator" -Credential "CONTOSO\TestUser"
    

    This command installs a package named DSCAccelerator. When you run this command, you are prompted to provide a password for the account that has rights to install the package.

  2. Install a package that you find with Find-Package:
    PS C:\> Find-Package "zoomit" | Install-Package
    

    This command installs a package named zoomit by piping the package from a Find-Package command.

  3. Install packages by specifying a range of versions:
    PS C:\> Install-Package -Name "DSCAccel" -MinimumVersion 2.1.2 -MaximumVersion 2.2
    

    This command installs any package that has a name matching the partial name DSCAccel. The command installs the newest version of the package, within a range of versions that is specified by adding the MinimumVersion and MaximumVersion parameters.

Additional Notes

This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

PowerShell Commands