Save-Package

Saves packages to the local computer without installing them.

Syntax

Save-Package
    [-Name] <String[]>
    [-RequiredVersion <String>]
    [-MinimumVersion <String>]
    [-MaximumVersion <String>]
    [-Source <String[]>]
    [-Path <String>]
    [-LiteralPath <String>]
    [-Credential <PSCredential>]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-AllVersions]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-ProviderName <String[]>]
    [<CommonParameters>]
Save-Package
    [-Path <String>]
    [-LiteralPath <String>]
    -InputObject <SoftwareIdentity>
    [-Credential <PSCredential>]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-AllVersions]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Save-Package
    [-Path <String>]
    [-LiteralPath <String>]
    [-Credential <PSCredential>]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-AllVersions]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-ConfigFile <String>]
    [-SkipValidate]
    [-Headers <String[]>]
    [-FilterOnTag <String[]>]
    [-Contains <String>]
    [-AllowPrereleaseVersions]
    [<CommonParameters>]
Save-Package
    [-Path <String>]
    [-LiteralPath <String>]
    [-Credential <PSCredential>]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-AllVersions]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-ConfigFile <String>]
    [-SkipValidate]
    [-Headers <String[]>]
    [-FilterOnTag <String[]>]
    [-Contains <String>]
    [-AllowPrereleaseVersions]
    [<CommonParameters>]
Save-Package
    [-Path <String>]
    [-LiteralPath <String>]
    [-Credential <PSCredential>]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-AllVersions]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-PackageManagementProvider <String>]
    [-PublishLocation <String>]
    [-ScriptSourceLocation <String>]
    [-ScriptPublishLocation <String>]
    [-Type <String>]
    [-Filter <String>]
    [-Tag <String[]>]
    [-Includes <String[]>]
    [-DscResource <String[]>]
    [-RoleCapability <String[]>]
    [-Command <String[]>]
    [<CommonParameters>]
Save-Package
    [-Path <String>]
    [-LiteralPath <String>]
    [-Credential <PSCredential>]
    [-Proxy <Uri>]
    [-ProxyCredential <PSCredential>]
    [-AllVersions]
    [-Force]
    [-ForceBootstrap]
    [-WhatIf]
    [-Confirm]
    [-PackageManagementProvider <String>]
    [-PublishLocation <String>]
    [-ScriptSourceLocation <String>]
    [-ScriptPublishLocation <String>]
    [-Type <String>]
    [-Filter <String>]
    [-Tag <String[]>]
    [-Includes <String[]>]
    [-DscResource <String[]>]
    [-RoleCapability <String[]>]
    [-Command <String[]>]
    [<CommonParameters>]

Description

The Save-Package cmdlet saves packages to the local computer without installing them. This cmdlet saves the newest version of a package unless you specify the AllVersions parameter. The DestinationPath and LiteralPath parameters are mutually exclusive, and cannot be added to the same command.

Examples

Example 1: Save a package to the local computer

PS C:\> Save-Package -Name "DSCAccelerator" -DestinationPath "C:\Users\TestUser\Downloads"

This example saves the newest version of a package, DSCAccelerator, to the C:\Users\TestUser\Downloads folder.

Example 2: Save an exact version of a package

PS C:\> Save-Package -Name "DSCAccelerator" -RequiredVersion "2.1.2" -DestinationPath "C:\Users\TestUser\Downloads"

This example saves only version 2.1.2 of a package, DSCAccelerator, to the C:\Users\TestUser\Downloads folder.

Example 3: Save a package by piping results of Find-Package

PS C:\> Find-Package -Name "DSCAccelerator" -RequiredVersion "2.1.2" | Save-Package -DestinationPath "C:\Users\TestUser\Downloads"

This command saves a package named DSCAccelerator by first locating the exact package with the Find-Package cmdlet, then piping the results of Find-Package to the Save-Package cmdlet.

Example 4: Save a package to a local folder, then install the package

PS C:\> Save-Package "notepad2" -DestinationPath "C:\temp"

PS C:\> Install-Package "C:\temp\notepad2.4.2.25.3.nupkg"

The first command saves a package to C:\temp, a folder on the local computer. The second command installs the saved package from the C:\temp folder, instead of installing from the web.

Required Parameters

-InputObject

A software ID object that represents the package that you want to save. Software IDs are part of the results of the Find-Package cmdlet.

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

Specifies one or more package names.

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

Optional Parameters

-AllVersions

Indicates that this cmdlet saves all available versions of the package. By default, Save-Package only returns the newest available version.

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

{{Fill AllowPrereleaseVersions Description}}

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

Specifies one or more commands included in the package.

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

{{Fill ConfigFile Description}}

Type: String
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
-Contains

{{Fill Contains Description}}

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Credential

Specifies a user account that has rights to save a package from a specified package provider or source.

Type: PSCredential
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-DscResource

Specifies one or more Desired State Configuration (DSC) resources for the package.

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

Specifies a filter for the package.

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-FilterOnTag

{{Fill FilterOnTag Description}}

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

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

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

Indicates that this cmdlet forces Package Management to automatically install the package provider for the specified package.

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

{{Fill Headers Description}}

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

Indicates the resources that the package includes.

Type: String[]
Parameter Sets: DscResource, Cmdlet, Function, Workflow
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-LiteralPath

Specifies the literal path to which you want to save the package. You cannot add both this parameter and the DestinationPath parameter to the same command.

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-MaximumVersion

Specifies the maximum allowed version of the package that you want to save. If you do not add this parameter, Save-Package saves the highest available version of the package.

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-MinimumVersion

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

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PackageManagementProvider

Specifies the Package Management provider.

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Path

Specifies the path at which to save the package.

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProviderName

Specifies one or more provider names.

Type: String[]
Aliases: Provider
Parameter Sets: Programs, msi, msu, PowerShellGet, nuget, chocolatey
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Proxy
Type: Uri
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProxyCredential
Type: PSCredential
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PublishLocation

Specifies the publish location.

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-RequiredVersion

Specifies the exact version of the package to save. If you do not add this parameter, Save-Package finds the highest available version of the provider that also satisfies any maximum version specified by the MaximumVersion parameter.

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

Specifies the script publish location.

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ScriptSourceLocation

Specifies the script source location.

Type: String
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SkipValidate

{{Fill SkipValidate Description}}

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

Specifies one or more package sources.

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

Specifies a tag to search for within the package metadata.

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

Specifies whether to search for packages with a module, a script, or either.

Type: String
Parameter Sets: Module, Script, All
Position: Named
Default value: None
Accept pipeline input: False
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

Inputs

You cannot pipe input to this cmdlet.

Outputs

This cmdlet does not generate any output.