Partager via


Save-PSResource

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

Syntaxe

IncludeXmlParameterSet (Default)

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

AsNupkgParameterSet

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

InputObjectParameterSet

Save-PSResource
    [-InputObject] <PSResourceInfo[]>
    [-Repository <String[]>]
    [-Credential <PSCredential>]
    [-AsNupkg]
    [-IncludeXml]
    [-Path <String>]
    [-TemporaryPath <String>]
    [-TrustRepository]
    [-PassThru]
    [-SkipDependencyCheck]
    [-AuthenticodeCheck]
    [-Quiet]
    [-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.

Exemples

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

Paramètres

-AcceptLicense

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

This parameter was added in PSResourceGet 1.1.0-rc1.

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AsNupkg

Saves the resource as a .nupkg file.

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False

Parameter sets

AsNupkgParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
InputObjectParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AuthenticodeCheck

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

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False
Alias:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Credential

Optional credentials used when accessing a repository.

Parameter properties

Type:PSCredential
Valeur par défaut:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeXml

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

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False

Parameter sets

IncludeXmlParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
InputObjectParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Used for pipeline input.

Parameter properties

Type:

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo[]

Valeur par défaut:None
Supports wildcards:False
DontShow:False
Alias:ParentResource

Parameter sets

InputObjectParameterSet
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

The name of one or more resources to install.

Parameter properties

Type:

String[]

Valeur par défaut:None
Supports wildcards:False
DontShow:False

Parameter sets

IncludeXmlParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
AsNupkgParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PassThru

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

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Path

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

Parameter properties

Type:String
Valeur par défaut:current directory
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Prerelease

When specified, includes prerelease versions in search results returned.

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False
Alias:IsPrerelease

Parameter sets

IncludeXmlParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
AsNupkgParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Quiet

Suppresses the progress bar output.

This parameter was added in PSResourceGet 1.1.0-rc1.

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:

String[]

Valeur par défaut:None
Supports wildcards:True
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SkipDependencyCheck

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

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Valeur par défaut:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TrustRepository

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

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Valeur par défaut:None
Supports wildcards:True
DontShow:False

Parameter sets

IncludeXmlParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
AsNupkgParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Valeur par défaut:False
Supports wildcards:False
DontShow:False
Alias:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Entrées

String

String

SwitchParameter

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo

Sorties

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.