< Back

Save-Package

Sat Jan 18, 2020 6:24 pm

NAME Save-Package



SYNOPSIS

Saves packages to the local computer without installing them.





SYNTAX

Save-Package [-AllVersions] [-AllowPrereleaseVersions] [-ConfigFile <String>] [-Confirm] [-Contains <String>]

[-Credential <PSCredential>] [-FilterOnTag <String[]>] [-Force] [-ForceBootstrap] [-Headers <String[]>]

[-LiteralPath <String>] [-Path <String>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-SkipValidate]

[-WhatIf] [<CommonParameters>]



Save-Package [-AllVersions] [-AllowPrereleaseVersions] [-ConfigFile <String>] [-Confirm] [-Contains <String>]

[-Credential <PSCredential>] [-FilterOnTag <String[]>] [-Force] [-ForceBootstrap] [-Headers <String[]>]

[-LiteralPath <String>] [-Path <String>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-SkipValidate]

[-WhatIf] [<CommonParameters>]



Save-Package [-AllVersions] [-Command <String[]>] [-Confirm] [-Credential <PSCredential>] [-DscResource

<String[]>] [-Filter <String>] [-Force] [-ForceBootstrap] [-Includes {DscResource | Cmdlet | Function | Workflow |

RoleCapability}] [-LiteralPath <String>] [-PackageManagementProvider <String>] [-Path <String>] [-Proxy <Uri>]

[-ProxyCredential <PSCredential>] [-PublishLocation <String>] [-RoleCapability <String[]>] [-ScriptPublishLocation

<String>] [-ScriptSourceLocation <String>] [-Tag <String[]>] [-Type {Module | Script | All}] [-WhatIf]

[<CommonParameters>]



Save-Package [-AllVersions] [-Command <String[]>] [-Confirm] [-Credential <PSCredential>] [-DscResource

<String[]>] [-Filter <String>] [-Force] [-ForceBootstrap] [-Includes {DscResource | Cmdlet | Function | Workflow |

RoleCapability}] [-LiteralPath <String>] [-PackageManagementProvider <String>] [-Path <String>] [-Proxy <Uri>]

[-ProxyCredential <PSCredential>] [-PublishLocation <String>] [-RoleCapability <String[]>] [-ScriptPublishLocation

<String>] [-ScriptSourceLocation <String>] [-Tag <String[]>] [-Type {Module | Script | All}] [-WhatIf]

[<CommonParameters>]



Save-Package [-AllVersions] [-Confirm] [-Credential <PSCredential>] [-Force] [-ForceBootstrap] -InputObject

<SoftwareIdentity> [-LiteralPath <String>] [-Path <String>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>]

[-WhatIf] [<CommonParameters>]



Save-Package [-Name] <String[]> [-AllVersions] [-Confirm] [-Credential <PSCredential>] [-Force] [-ForceBootstrap]

[-LiteralPath <String>] [-MaximumVersion <String>] [-MinimumVersion <String>] [-Path <String>] [-ProviderName {msi

| NuGet | msu | Programs | PowerShellGet | psl | chocolatey}] [-Proxy <Uri>] [-ProxyCredential <PSCredential>]

[-RequiredVersion <String>] [-Source <String[]>] [-WhatIf] [<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.





PARAMETERS

-AllVersions [<SwitchParameter>]

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

the newest available version.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-AllowPrereleaseVersions [<SwitchParameter>]

{{Fill AllowPrereleaseVersions Description}}



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Command <String[]>

Specifies one or more commands included in the package.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ConfigFile <String>

{{Fill ConfigFile Description}}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Contains <String>

{{Fill Contains Description}}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Credential <PSCredential>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DscResource <String[]>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Filter <String>

Specifies a filter for the package.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-FilterOnTag <String[]>

{{Fill FilterOnTag Description}}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

Indicates that this cmdlet overrides restrictions that prevent the command from succeeding, as long as running

the command does not compromise security.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-ForceBootstrap [<SwitchParameter>]

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

specified package.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Headers <String[]>

{{Fill Headers Description}}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Includes <String[]>

Indicates the resources that the package includes.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InputObject <SoftwareIdentity>

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.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-LiteralPath <String>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-MaximumVersion <String>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-MinimumVersion <String>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Name <String[]>

Specifies one or more package names.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-PackageManagementProvider <String>

Specifies the Package Management provider.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Path <String>

Specifies the path at which to save the package.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ProviderName <String[]>

Specifies one or more provider names.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Proxy <Uri>

@{Text=}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ProxyCredential <PSCredential>

@{Text=}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-PublishLocation <String>

Specifies the publish location.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-RequiredVersion <String>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-RoleCapability <String[]>

@{Text=}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ScriptPublishLocation <String>

Specifies the script publish location.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ScriptSourceLocation <String>

Specifies the script source location.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-SkipValidate [<SwitchParameter>]

{{Fill SkipValidate Description}}



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Source <String[]>

Specifies one or more package sources.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Tag <String[]>

Specifies a tag to search for within the package metadata.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Type <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

You cannot pipe input to this cmdlet.







OUTPUTS

This cmdlet does not generate any output.







NOTES









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.



RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=517140

about_PackageManagement

Get-Package

Install-Package

Save-Package

Uninstall-Package