Save-PSResource

Saves resources (modules and scripts) from a registered repository onto the machine.

Syntax

Save-PSResource
    [-Name] <String[]>
    [-Version <String>]
    [-Prerelease]
    [-Repository <String[]>]
    [-Credential <PSCredential>]
    [-IncludeXml]
    [-Path <String>]
    [-TemporaryPath <String>]
    [-TrustRepository]
    [-PassThru]
    [-SkipDependencyCheck]
    [-AuthenticodeCheck]
    [-AcceptLicense]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Save-PSResource
    [-Name] <String[]>
    [-Version <String>]
    [-Prerelease]
    [-Repository <String[]>]
    [-Credential <PSCredential>]
    [-AsNupkg]
    [-Path <String>]
    [-TemporaryPath <String>]
    [-TrustRepository]
    [-PassThru]
    [-SkipDependencyCheck]
    [-AuthenticodeCheck]
    [-AcceptLicense]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Save-PSResource
    [-Repository <String[]>]
    [-Credential <PSCredential>]
    [-AsNupkg]
    [-IncludeXml]
    [-Path <String>]
    [-TemporaryPath <String>]
    [-TrustRepository]
    [-PassThru]
    [-InputObject] <PSResourceInfo[]>
    [-SkipDependencyCheck]
    [-AuthenticodeCheck]
    [-AcceptLicense]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This cmdlet combines the functionality of the Save-Module and Save-Script cmdlets from PowerShellGet v2. Save-PSResource downloads a resource from a registered repository to a specific path on the local machine. By default, the resource is saved in the unpacked or installed format. The scripts or modules could be run from the saved location. There is also an option to download the resource in .nupkg format.

Examples

Example 1

Downloads the Az module from the highest priority repository and saves it to the current location.

Save-PSResource -Name Az

Example 2

Downloads the Az module from the PowerShell Gallery and saves it to the current location.

Save-PSResource -Name Az -Repository PSGallery

Example 3

Downloads the Az module from the highest priority repository and saves it in .nupkg format to the current location.

Save-PSResource Az -AsNupkg

Example 4

Downloads the Az module from the highest priority repository and includes the PowerShellGet XML metadata file.

Save-PSResource Az -IncludeXML

Parameters

-AcceptLicense

For modules that require a license, automatically accepts the license agreement during installation.

This parameter was added in PSResourceGet 1.1.0-rc1.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AsNupkg

Saves the resource as a .nupkg file.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AuthenticodeCheck

Validates the resource's signed files and catalog files on Windows.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Optional credentials used when accessing a repository.

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

-IncludeXml

Includes the PowerShellGet metadata XML used to verify that PowerShellGet has installed a module.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Used for pipeline input.

Type:Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo[]
Aliases:ParentResource
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

The name of one or more resources to install.

Type:String[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PassThru

When specified, outputs a PSResourceInfo object for the saved resource.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

Specifies the path to save the resource to. If no path is provided, the resource is saved in the current directory.

Type:String
Position:Named
Default value:current directory
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Prerelease

When specified, includes prerelease versions in search results returned.

Type:SwitchParameter
Aliases:IsPrerelease
Position:Named
Default value:False
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Quiet

Suppresses the progress bar output.

This parameter was added in PSResourceGet 1.1.0-rc1.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Repository

Specifies one or more repository names to search. If not specified, search includes all registered repositories, in priority order (highest first), until a repository is found that contains the package. Repositories are sorted by priority then by name. Lower Priority values have a higher precedence.

When searching for resources across multiple repositories, the PSResourceGet cmdlets search the repositories using this sort order. Save-PSResource saves the first matching package from the sorted list of repositories.

The parameter supports the * wildcard character. If you specify multiple repositories, all names must include or omit the wildcard character. You can't specify a mix of names with and without wildcards.

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

-SkipDependencyCheck

Skips the check for resource dependencies. Only found resources are installed. No resources of the found resource are installed.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TemporaryPath

Specifies the path to temporarily install the resource before saving. If no temporary path is provided, the resource is temporarily installed in the current user's temporary folder.

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

-TrustRepository

Suppress prompts to trust repository. The prompt to trust repository only occurs if the repository isn't configured as trusted.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Version

Specifies the version of the resource to be returned. The value can be an exact version or a version range using the NuGet versioning syntax.

For more information about NuGet version ranges, see Package versioning.

PowerShellGet supports all but the minimum inclusive version listed in the NuGet version range documentation. Using 1.0.0.0 as the version doesn't yield versions 1.0.0.0 and higher (minimum inclusive range). Instead, the value is considered to be the required version. To search for a minimum inclusive range, use [1.0.0.0, ] as the version range.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:True

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String[]

String

SwitchParameter

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo[]

Outputs

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo

By default, the cmdlet doesn't return any objects. When the PassThru parameter is used, the cmdlet outputs a PSResourceInfo object for the saved resource.