次の方法で共有


Install-PSResource

Installs resources from a registered repository.

構文

NameParameterSet (既定)

Install-PSResource
    [-Name] <String[]>
    [-Version <String>]
    [-Prerelease]
    [-Repository <String[]>]
    [-Credential <PSCredential>]
    [-Scope <ScopeType>]
    [-TemporaryPath <String>]
    [-TrustRepository]
    [-Reinstall]
    [-Quiet]
    [-AcceptLicense]
    [-NoClobber]
    [-SkipDependencyCheck]
    [-AuthenticodeCheck]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

InputObjectParameterSet

Install-PSResource
    [-InputObject] <PSResourceInfo[]>
    [-Repository <String[]>]
    [-Credential <PSCredential>]
    [-Scope <ScopeType>]
    [-TemporaryPath <String>]
    [-TrustRepository]
    [-Reinstall]
    [-Quiet]
    [-AcceptLicense]
    [-NoClobber]
    [-SkipDependencyCheck]
    [-AuthenticodeCheck]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

RequiredResourceFileParameterSet

Install-PSResource
    -RequiredResourceFile <String>
    [-Credential <PSCredential>]
    [-Scope <ScopeType>]
    [-TemporaryPath <String>]
    [-TrustRepository]
    [-Reinstall]
    [-Quiet]
    [-AcceptLicense]
    [-NoClobber]
    [-SkipDependencyCheck]
    [-AuthenticodeCheck]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

RequiredResourceParameterSet

Install-PSResource
    -RequiredResource <Object>
    [-Credential <PSCredential>]
    [-Scope <ScopeType>]
    [-TemporaryPath <String>]
    [-TrustRepository]
    [-Reinstall]
    [-Quiet]
    [-AcceptLicense]
    [-NoClobber]
    [-SkipDependencyCheck]
    [-AuthenticodeCheck]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

説明

This cmdlet installs resources from a registered repository to an installation path on a machine. By default, the cmdlet doesn't return any object. Other parameters allow you to specify the repository, scope, and version for a resource, and suppress license prompts.

This cmdlet combines the functions of the Install-Module and Install-Script cmdlets from PowerShellGet v2.

Install-PSResource doesn't load the newly installed module into the current session. You must import the new version or start a new session to use the updated module. For more information, see Import-Module.

Note

Install-PSResource doesn't install dependent resources from repositories that use the NuGet v3 protocol. You must install the dependent resources individually. We intend to add this feature in a future release.

Example 1

Installs the latest stable (non-prerelease) version of the Az module from the PowerShell Gallery.

Install-PSResource Az -Repository PSGallery

The Az module is a meta-module that includes all the Az PowerShell modules as dependencies. This command installs the Az module and all its dependencies.

Example 2

Installs the latest stable Az module within the between versions 7.3.0 and 8.3.0.

Install-PSResource Az -Version '[7.3.0, 8.3.0]'

Example 3

Installs the latest stable version of the Az module. When the Reinstall parameter is used, the cmdlet writes over any previously installed version.

Install-PSResource Az -Reinstall

Example 4

Installs the PSResources specified in the psd1 file.

Install-PSResource -RequiredResourceFile myRequiredModules.psd1

Example 5

Installs the PSResources specified in the hashtable.

Install-PSResource -RequiredResource  @{
    TestModule = @{
        version = '[0.0.1,1.3.0]'
        repository = 'PSGallery'
      }
    TestModulePrerelease = @{
        version = '[0.0.0,0.0.5]'
        repository = 'PSGallery'
        prerelease = 'true'
    }
    TestModule99 = @{}
}

パラメーター

-AcceptLicense

Specifies that the resource should accept any request to accept the license agreement. This suppresses prompting if the module mandates that a user accept the license agreement.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-AuthenticodeCheck

Validates Authenticode signatures and catalog files on Windows.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Confirm

Prompts you for confirmation before running the cmdlet.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False
Aliases:cf

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Credential

Optional credentials used when accessing a repository.

パラメーターのプロパティ

型:PSCredential
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-InputObject

Used for pipeline input.

パラメーターのプロパティ

型:

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo[]

規定値:None
ワイルドカードのサポート:False
DontShow:False
Aliases:ParentResource

パラメーター セット

InputObjectParameterSet
配置:0
必須:True
パイプラインからの値:True
プロパティ名別のパイプラインからの値:True
残りの引数からの値:False

-Name

The name of one or more resources to install.

パラメーターのプロパティ

型:

String[]

規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

NameParameterSet
配置:0
必須:True
パイプラインからの値:True
プロパティ名別のパイプラインからの値:True
残りの引数からの値:False

-NoClobber

Prevents installing a package that contains cmdlets that already exist on the machine.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-PassThru

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

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Prerelease

When specified, includes prerelease versions in search results returned.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False
Aliases:IsPrerelease

パラメーター セット

NameParameterSet
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:True
残りの引数からの値:False

-Quiet

Suppresses installation progress bar.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Reinstall

Installs the latest version of a module even if the latest version is already installed. The installed version is overwritten. This allows you to repair a damaged installation of the module.

If an older version of the module is installed, the new version is installed side-by-side in a new version-specific folder.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値: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. Install-PSResource installs 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.

パラメーターのプロパティ

型:

String[]

規定値:None
ワイルドカードのサポート:True
DontShow:False

パラメーター セット

NameParameterSet
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:True
残りの引数からの値:False
InputObjectParameterSet
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:True
残りの引数からの値:False

-RequiredResource

A hashtable or JSON string that specifies resources to install. Wildcard characters aren't allowed. See the NOTES section for a description of the file formats.

パラメーターのプロパティ

型:Object
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

RequiredResourceParameterSet
配置:Named
必須:True
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-RequiredResourceFile

Path to a .psd1 or .json that specifies resources to install. Wildcard characters aren't allowed. See the NOTES section for a description of the file formats.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

RequiredResourceFileParameterSet
配置:Named
必須:True
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Scope

Specifies the installation scope. Accepted values are:

  • CurrentUser
  • AllUsers

The default scope is CurrentUser, which doesn't require elevation for install.

The AllUsers scope installs modules in a location accessible to all users of the computer. For example:

  • $env:ProgramFiles\PowerShell\Modules

The CurrentUser installs modules in a location accessible only to the current user of the computer. For example:

  • $home\Documents\PowerShell\Modules

パラメーターのプロパティ

型:Microsoft.PowerShell.PSResourceGet.UtilClasses.ScopeType
規定値:None
指定可能な値:CurrentUser, AllUsers
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-SkipDependencyCheck

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

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-TemporaryPath

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

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-TrustRepository

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

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値: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.

パラメーターのプロパティ

型:String
規定値:None
ワイルドカードのサポート:True
DontShow:False

パラメーター セット

NameParameterSet
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:True
残りの引数からの値:False

-WhatIf

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

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False
Aliases:wi

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値: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.

入力

String

String

SwitchParameter

Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo

出力

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.

メモ

The module defines isres as an alias for Install-PSResource.

The RequiredResource and RequiredResourceFile parameters are used to find PSResource objects matching specific criteria. You can specify the search criteria using a hashtable or a JSON object. For the RequiredResourceFile parameter, the hashtable is stored in a .psd1 file and the JSON object is stored in a .json file. For more information, see about_PSResourceGet.