Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Save-Package

Save-Package

microsoft.powershell.oneget.dll, microsoft.powershell.packagemanagement.dll

Synopsis

Saves packages to the local computer without installing them.

Syntax

Save-Package [-Name] [-Credential] [-DestinationPath] [-Force] [-ForceBootstrap] [-IncludeDependencies] [-LiteralPath] [-MaximumVersion] [-MinimumVersion] [-ProviderName] [-RequiredVersion] [-Source] [-InputObject] [-Confirm] [-WhatIf] [<CommonParameters>]

Detailed Description

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

Parameters

-Credential <PSCredential>

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

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-DestinationPath <String>

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

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Force <SwitchParameter>

Overrides restrictions that prevent the command from succeeding, as long as running the command does not compromise security.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ForceBootstrap <SwitchParameter>

Forces OneGet to bootstrap—or automatically install—the package provider for the specified package.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-IncludeDependencies <SwitchParameter>

If you add this parameter, the search scope is expanded to include packages on which the specified package depends.

Aliases

None

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.

Aliases

None

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.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-MaximumVersion <String>

Specifies the highest-numbered version of the package to be saved. If you do not add this parameter, Save-Package saves the newest version of the package.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-MinimumVersion <String>

Specifies the lowest-numbered version of the package to be saved. If you do not add this parameter, the newest available version of the package (subject to the maximum specified version, if any) is saved.

Aliases

Version

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Name <String[]>

Specifies one or more package names, or partial package names. Separate multiple package names with commas.

Aliases

None

Required?

false

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ProviderName <String[]>

Specifies one or more provider names. Separate multiple provider names with commas.

Aliases

Provider

Required?

false

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-RequiredVersion <String>

Specifies the exact version of the package that you want to find. By default, without this parameter, Save-Package returns the newest available version.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Source <String[]>

Specifies one or more package sources. You can get a list of available package sources by running the Get-PackageSource cmdlet.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-Confirm <SwitchParameter>

Prompts you for confirmation before running the cmdlet.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-WhatIf <SwitchParameter>

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

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type


Return Type


Notes

None

Examples

Example 1: Save a package to the local computer

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

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

Example 2: Save an exact version of a package

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

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

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

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.

PS C:\>Find-Package –Name DSCAccel –RequiredVersion 2.1.2 | Save-Package –DestinationPath 'C:\Users\TestUser\Downloads'

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

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.

PS C:\>Save-Package notepad2 –DestinationPath C:\temp
PS C:\>Install-Package C:\temp\notepad2.4.2.25.3.nupkg

Online Version
Get-Package
Install-Package
Save-Package
Uninstall-Package