Save-Script
構文
NameAndPathParameterSet (既定)
Save-Script
[-Name] <String[]>
[-Path] <String>
[-MinimumVersion <String>]
[-MaximumVersion <String>]
[-RequiredVersion <String>]
[-Repository <String[]>]
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-Credential <PSCredential>]
[-Force]
[-AllowPrerelease]
[-AcceptLicense]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
NameAndLiteralPathParameterSet
Save-Script
[-Name] <String[]>
-LiteralPath <String>
[-MinimumVersion <String>]
[-MaximumVersion <String>]
[-RequiredVersion <String>]
[-Repository <String[]>]
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-Credential <PSCredential>]
[-Force]
[-AllowPrerelease]
[-AcceptLicense]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Save-Script
[-InputObject] <PSObject[]>
-LiteralPath <String>
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-Credential <PSCredential>]
[-Force]
[-AcceptLicense]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Save-Script
[-InputObject] <PSObject[]>
[-Path] <String>
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-Credential <PSCredential>]
[-Force]
[-AcceptLicense]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
説明
The Save-Script
cmdlet saves the specified script.
This is a proxy cmdlet for the Save-PSResource
cmdlet in the
Microsoft.PowerShell.PSResourceGet . For more information, see
Save-PSResource .
例
Example 1: Save a script and validate the script's metadata
In this example, a script from a repository is saved to the local computer and the script's metadata
is validated.
Save-Script -Name Install-VSCode -Repository PSGallery -Path C:\Test\Scripts
Test-ScriptFileInfo -Path C:\Test\Scripts\Install-VSCode.ps1
Version Name Author Description
------- ---- ------ -----------
1.3 Install-VSCode Microsoft This script can be used to easily install Visual Studio Code
Save-Script
uses the Name parameter to specify the script's name. The Repository parameter
specifies where to find the script. The script is saved in the location specified by the Path
parameter. Test-ScriptFileInfo
specifies the Path and validates the script's metadata.
パラメーター
-AcceptLicense
The proxy cmdlet ignores this parameter since it's not supported by Save-PSResource
.
パラメーターのプロパティ
パラメーター セット
(All)
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: False
残りの引数からの値: False
-AllowPrerelease
The proxy cmdlet maps this parameter to the Prerelease parameter of Save-PSResource
.
パラメーターのプロパティ
パラメーター セット
NameAndPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: False
残りの引数からの値: False
NameAndLiteralPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: False
残りの引数からの値: False
-Confirm
Prompts you for confirmation before running Save-Script
.
パラメーターのプロパティ
パラメーター セット
(All)
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: False
残りの引数からの値: False
-Credential
Specifies a user account that has permission to save a script.
パラメーターのプロパティ
パラメーター セット
(All)
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-Force
The proxy cmdlet ignores this parameter since it's not supported by Save-PSResource
.
パラメーターのプロパティ
パラメーター セット
(All)
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: False
残りの引数からの値: False
Accepts a PSRepositoryItemInfo object. For example, output Find-Script
to a variable and use
that variable as the InputObject argument.
型: PSObject [ ]
規定値: None
ワイルドカードのサポート: False
DontShow: False
InputObjectAndLiteralPathParameterSet
配置: 0
必須: True
パイプラインからの値: True
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
InputObjectAndPathParameterSet
配置: 0
必須: True
パイプラインからの値: True
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-LiteralPath
Specifies a path to one or more locations. The value of the LiteralPath parameter is used
exactly as entered. No characters are interpreted as wildcards. If the path includes escape
characters, enclose the path within single quotation marks. PowerShell doesn't interpret any
characters enclosed in single quotation marks as escape sequences.
The proxy cmdlet maps this parameter to the Path parameter of Save-PSResource
.
パラメーターのプロパティ
型: String
規定値: None
ワイルドカードのサポート: False
DontShow: False
Aliases: PSPath
パラメーター セット
NameAndLiteralPathParameterSet
配置: Named
必須: True
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
InputObjectAndLiteralPathParameterSet
配置: Named
必須: True
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-MaximumVersion
The proxy cmdlet uses the value of this parameter to create a NuGet version search string for use
with the Version parameter of Save-PSResource
.
パラメーターのプロパティ
型: String
規定値: None
ワイルドカードのサポート: False
DontShow: False
パラメーター セット
NameAndPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
NameAndLiteralPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-MinimumVersion
The proxy cmdlet uses the value of this parameter to create a NuGet version search string for use
with the Version parameter of Save-PSResource
.
パラメーターのプロパティ
型: String
規定値: None
ワイルドカードのサポート: False
DontShow: False
パラメーター セット
NameAndPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
NameAndLiteralPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-Name
Specifies an array of script names to save.
パラメーターのプロパティ
型: String [ ]
規定値: None
ワイルドカードのサポート: False
DontShow: False
パラメーター セット
NameAndPathParameterSet
配置: 0
必須: True
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
NameAndLiteralPathParameterSet
配置: 0
必須: True
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-Path
Specifies the location on the local computer to store a saved module. Accepts wildcard characters.
パラメーターのプロパティ
型: String
規定値: None
ワイルドカードのサポート: True
DontShow: False
パラメーター セット
NameAndPathParameterSet
配置: 1
必須: True
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
InputObjectAndPathParameterSet
配置: 1
必須: True
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-Proxy
The proxy cmdlet ignores this parameter since it's not supported by Save-PSResource
.
パラメーターのプロパティ
型: Uri
規定値: None
ワイルドカードのサポート: False
DontShow: False
パラメーター セット
(All)
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-ProxyCredential
The proxy cmdlet ignores this parameter since it's not supported by Save-PSResource
.
パラメーターのプロパティ
パラメーター セット
(All)
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-Repository
Specifies the friendly name of a repository that has been registered by running
Register-PSRepository
. Use Get-PSRepository
to display registered repositories.
パラメーターのプロパティ
型: String [ ]
規定値: None
ワイルドカードのサポート: False
DontShow: False
パラメーター セット
NameAndPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
NameAndLiteralPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-RequiredVersion
The proxy cmdlet uses the value of this parameter to create a NuGet version search string for use
with the Version parameter of Save-PSResource
.
パラメーターのプロパティ
型: String
規定値: None
ワイルドカードのサポート: False
DontShow: False
パラメーター セット
NameAndPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
NameAndLiteralPathParameterSet
配置: Named
必須: False
パイプラインからの値: False
プロパティ名別のパイプラインからの値: True
残りの引数からの値: False
-WhatIf
Shows what would happen if Save-Script
runs. The cmdlet isn't run.
パラメーターのプロパティ
パラメーター セット
(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 .
出力
メモ
The PowerShell Gallery no longer supports Transport Layer Security (TLS) versions 1.0 and 1.1. You
must use TLS 1.2 or higher. Use the following command to ensure you are using TLS 1.2:
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12