| external help file | Microsoft.PowerShell.PackageManagement.dll-Help.xml |
|---|---|
| Locale | en-US |
| Module Name | PackageManagement |
| ms.date | 12/12/2022 |
| online version | https://learn.microsoft.com/powershell/module/packagemanagement/save-package?view=powershellget-2.x&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
| title | Save-Package |
Saves packages to the local computer without installing them.
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]
[-AllowPrereleaseVersions] [-PackageManagementProvider <String>] [-PublishLocation <String>]
[-ScriptSourceLocation <String>] [-ScriptPublishLocation <String>] [-Type <String>]
[-Filter <String>] [-Tag <String[]>] [-Includes <String[]>] [-DscResource <String[]>]
[-RoleCapability <String[]>] [-Command <String[]>] [-AcceptLicense] [<CommonParameters>]
Save-Package [-Path <String>] [-LiteralPath <String>] [-Credential <PSCredential>] [-Proxy <Uri>]
[-ProxyCredential <PSCredential>] [-AllVersions] [-Force] [-ForceBootstrap] [-WhatIf] [-Confirm]
[-AllowPrereleaseVersions] [-PackageManagementProvider <String>] [-PublishLocation <String>]
[-ScriptSourceLocation <String>] [-ScriptPublishLocation <String>] [-Type <String>]
[-Filter <String>] [-Tag <String[]>] [-Includes <String[]>] [-DscResource <String[]>]
[-RoleCapability <String[]>] [-Command <String[]>] [-AcceptLicense] [<CommonParameters>]
The Save-Package cmdlet saves packages to the local computer but doesn't install the packages.
This cmdlet saves the newest version of a package unless you specify a RequiredVerion. The
Path and LiteralPath parameters are mutually exclusive, and cannot be added to the same
command.
This example saves the newest version of the package to a directory on the local computer. The package's dependencies are download with the package.
PS> Save-Package -Name NuGet.Core -ProviderName NuGet -Path C:\LocalPkg
Name Version Source Summary
---- ------- ------ -------
Microsoft.Web.Xdt 3.0.0 Nuget Microsoft Xml Document Transformation (XDT) enables...
NuGet.Core 2.14.0 Nuget NuGet.Core is the core framework assembly for NuGet...
Save-Package uses the Name parameter to specify the package. The package is downloaded from
the repository specified by the ProviderName parameter. The Path parameter determines where
the package is saved.
This example specifies the package version and saves it to a directory on the local computer.
PS> Save-Package -Name NuGet.Core -RequiredVersion 2.9.0 -ProviderName NuGet -Path C:\LocalPkg
Name Version Source Summary
---- ------- ------ -------
Microsoft.Web.Xdt 3.0.0 Nuget Microsoft Xml Document Transformation (XDT) enables...
NuGet.Core 2.9.0 Nuget NuGet.Core is the core framework assembly for NuGet...
Save-Package uses the Name parameter to specify the package. RequiredVersion indicates a
specific package version. The package is downloaded from the repository specified by the
ProviderName parameter. The Path parameter determines where the package is saved.
This command uses Find-Package to locate the newest version of the package and sends the object to
Save-Package.
PS> Find-Package -Name NuGet.Core -ProviderName NuGet | Save-Package -Path C:\LocalPkg
Find-Package uses the Name parameter to specify the package. The package is downloaded from
the repository specified by the ProviderName parameter. The object is sent down the pipeline to
Save-Package. The Path parameter determines where the package is saved.
The newest version of the package and its dependencies are downloaded and installed on the local computer.
PS> Save-Package -Name NuGet.Core -ProviderName NuGet -Path C:\LocalPkg
PS> Install-Package C:\LocalPkg\NuGet.Core.2.14.0.nupkg
Save-Package downloads the package file and its dependencies to the local computer.
Install-Package installs the package and dependencies from the specified directory.
Automatically accept the license agreement during installation if the package requires it.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseAllows packages marked as Prerelease to be saved.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: NuGet:PackageByInputObject, NuGet, PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseIndicates that this cmdlet saves all available versions of the package.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies one or more commands included in the package.
Type: System.String[]
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies a configuration File.
Type: System.String
Parameter Sets: NuGet:PackageByInputObject, NuGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSave-Package gets objects if any item in the object's property values are an exact match for the
specified value.
Type: System.String
Parameter Sets: NuGet:PackageByInputObject, NuGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies a user account that has permission to save a package from a specified package provider or source.
Type: System.Management.Automation.PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies one or more Desired State Configuration (DSC) resources for the package.
Type: System.String[]
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies a filter for the package.
Type: System.String
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the tag that filters the results. Results that don't contain the specified tag are excluded.
Type: System.String[]
Parameter Sets: NuGet:PackageByInputObject, NuGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseForces the command to run without asking for user confirmation.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseIndicates that Save-Package forces PackageManagement to automatically install the package
provider for the specified package.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the headers for the package.
Type: System.String[]
Parameter Sets: NuGet:PackageByInputObject, NuGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseIndicates the resources that the package includes.
Type: System.String[]
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Accepted values: DscResource, Cmdlet, Function, Workflow, RoleCapability
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseA 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: Microsoft.PackageManagement.Packaging.SoftwareIdentity
Parameter Sets: PackageByInputObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseSpecifies the literal path to which you want to save the package. You cannot add both this parameter and the Path parameter to the same command.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the maximum version of the package that you want to save.
Type: System.String
Parameter Sets: PackageBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the minimum version of the package that you want to find.
Type: System.String
Parameter Sets: PackageBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies one or more package names.
Type: System.String[]
Parameter Sets: PackageBySearch
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies a package management provider.
Type: System.String
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the location on the local computer to store the package.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies one or more provider names.
Type: System.String[]
Parameter Sets: PackageBySearch
Aliases: Provider
Accepted values: Bootstrap, NuGet, PowerShellGet
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies a proxy server for the request, rather than a direct connection to the internet resource.
Type: System.Uri
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies a user account that has permission to use the proxy server that is specified by the Proxy parameter.
Type: System.Management.Automation.PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the publish location.
Type: System.String
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the exact version of the package to save.
Type: System.String
Parameter Sets: PackageBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies an array of role capabilities.
Type: System.String[]
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the script publish location.
Type: System.String
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the script source location.
Type: System.String
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSwitch that skips validating the credentials of a package.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: NuGet:PackageByInputObject, NuGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies one or more package sources.
Type: System.String[]
Parameter Sets: PackageBySearch
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies a tag to search for within the package metadata.
Type: System.String[]
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies whether to search for packages with a module, a script, or either.
Type: System.String
Parameter Sets: PowerShellGet:PackageByInputObject, PowerShellGet
Aliases:
Accepted values: Module, Script, All
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can pipe a SoftwareIdentity object to this cmdlet.
This cmdlet returns no output.
Important
As of April 2020, the PowerShell Gallery no longer supports Transport Layer Security (TLS) versions 1.0 and 1.1. If you are not using TLS 1.2 or higher, you will receive an error when trying to access the PowerShell Gallery. Use the following command to ensure you are using TLS 1.2:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
For more information, see the announcement in the PowerShell blog.