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.
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.
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.
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.
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.
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.
Collaborer avec nous sur GitHub
La source de ce contenu se trouve sur GitHub, où vous pouvez également créer et examiner les problèmes et les demandes de tirage. Pour plus d’informations, consultez notre guide du contributeur.