Save-Package

Saves packages to the local computer without installing them.
Save-Package [[-Name] [<String[]>]] [-AllVersions] [-MaximumVersion [<String>]] [-MinimumVersion [<String>]][-Path [<String>]] [-ProviderName {Programs | msi | msu | PowerShellGet | nuget | chocolatey}] [-RequiredVersion[<String>]] [-Source [<String[]>]] [-Confirm] [-WhatIf] [<CommonParameters>]
Save-Package [-AllVersions] [-Credential [<PSCredential>]] [-Force] [-ForceBootstrap] [-LiteralPath [<String>]][-Path [<String>]] -InputObject* <SoftwareIdentity> [-Confirm] [-WhatIf] [<CommonParameters>]
Save-Package [-AllVersions] [-Command [<String[]>]] [-DscResource [<String[]>]] [-Filter [<String>]] [-Includes{DscResource | Cmdlet | Function | Workflow}] [-PackageManagementProvider [<String>]] [-Path [<String>]][-PublishLocation [<String>]] [-ScriptPublishLocation [<String>]] [-ScriptSourceLocation [<String>]] [-Tag[<String[]>]] [-Type {Module | Script | All}] [-Confirm] [-WhatIf] [<CommonParameters>]
Save-Package [-AllVersions] [-Command [<String[]>]] [-DscResource [<String[]>]] [-Filter [<String>]] [-Includes{DscResource | Cmdlet | Function | Workflow}] [-PackageManagementProvider [<String>]] [-Path [<String>]][-PublishLocation [<String>]] [-ScriptPublishLocation [<String>]] [-ScriptSourceLocation [<String>]] [-Tag[<String[]>]] [-Type {Module | Script | All}] [-Confirm] [-WhatIf] [<CommonParameters>]

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.

-Command [<String[]>]

Specifies one or more commands included in the package.

-Credential [<PSCredential>]

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

-DscResource [<String[]>]

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

-Filter [<String>]

Specifies a filter for the package.

-Force [<SwitchParameter>]

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

-ForceBootstrap [<SwitchParameter>]

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

-Includes [<String[]>]

Indicates the resources that the package includes.

-InputObject <SoftwareIdentity>

  • This value is required
  • Accepts pipeline input ByValue

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.

-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.

-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.

-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.

-Name [<String[]>]

Specifies one or more package names.

-PackageManagementProvider [<String>]

Specifies the Package Management provider.

-Path [<String>]

Specifies the path at which to save the package.

-ProviderName [<String[]>]

Specifies one or more provider names.

-PublishLocation [<String>]

Specifies the publish location.

-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.

-ScriptPublishLocation [<String>]

Specifies the script publish location.

-ScriptSourceLocation [<String>]

Specifies the script source location.

-Source [<String[]>]

Specifies one or more package sources.

-Tag [<String[]>]

Specifies a tag to search for within the package metadata.

-Type [<String>]

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

-Confirm [<SwitchParameter>]

  • Default value is false

Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.

-WhatIf [<SwitchParameter>]

  • Default value is false

Shows what would happen if the cmdlet runs. The cmdlet is not run.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.

Inputs

You cannot pipe input to this cmdlet.

Outputs

This cmdlet does not generate any output.

Examples
  1. Save a package to the local computer:
    PS C:> Save-Package -Name "DSCAccelerator" -DestinationPath "C:UsersTestUserDownloads"
    

    This example saves the newest version of a package, DSCAccelerator, to the C:UsersTestUserDownloads folder.

  2. Save an exact version of a package:
    PS C:> Save-Package -Name "DSCAccelerator" -RequiredVersion "2.1.2" -DestinationPath "C:UsersTestUserDownloads"
    

    This example saves only version 2.1.2 of a package, DSCAccelerator, to the C:UsersTestUserDownloads folder.

  3. Save a package by piping results of Find-Package:
    PS C:> Find-Package -Name "DSCAccelerator" -RequiredVersion "2.1.2" | Save-Package -DestinationPath "C:UsersTestUserDownloads"
    

    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.

  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:tempnotepad2.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

Get-Package
Install-Package
Save-Package
Uninstall-Package