New-SCScriptCommandSetting
New-SCScriptCommandSetting
Creates a settings object for a script command.
構文
Parameter Set: DefaultParamSet
New-SCScriptCommandSetting [-AlwaysReboot <Boolean> ] [-CommandMayReboot] [-FailOnMatch] [-MatchExitCode <String> ] [-MatchRebootExitCode <String> ] [-MatchStandardError <String> ] [-MatchStandardOutput <String> ] [-PersistStandardErrorPath <String> ] [-PersistStandardOutputPath <String> ] [-RestartOnRetry <Boolean> ] [-RestartScriptOnExitCodeReboot <Boolean> ] [-WarnAndContinueOnMatch] [-WorkingDirectory <String> ] [ <CommonParameters>]
詳細説明
The New-SCScriptCommandSetting cmdlet creates a settings object for a script command.
パラメーター
-AlwaysReboot<Boolean>
Indicates whether a computer or virtual machine should always restart after the script has finished running.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-CommandMayReboot
Indicates that the script command may reboot the computer or virtual machine.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-FailOnMatch
Indicates that the action taken when a failure policy is matched is to fail.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-MatchExitCode<String>
Specifies the failure policy exit code.
Example format: -MatchExitCode "[1-9][0-9]*"
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-MatchRebootExitCode<String>
Specifies the restart policy match exit code.
Example format: -MatchRebootExitCode "{1641}|{3010}|{3011}"
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-MatchStandardError<String>
Specifies the failure policy standard error.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-MatchStandardOutput<String>
Specifies the failure policy standard output.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-PersistStandardErrorPath<String>
Specifies the file path to store the standard error.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-PersistStandardOutputPath<String>
Specifies the file path to store the standard output.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-RestartOnRetry<Boolean>
Specifies whether a script is restarted upon VMM job restart if the previous job failure was due to a script failure when used in conjunction with New-SCScriptCommandSetting or Set-SCScriptCommandSetting.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-RestartScriptOnExitCodeReboot<Boolean>
Indicates whether the script restarts after the computer or virtual machine is restarted when an exit code is matched.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-WarnAndContinueOnMatch
Indicates that the action taken when a failure policy is matched is to warn the user and continue the operation.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
-WorkingDirectory<String>
Specifies a working directory for a script command.
エイリアス |
none |
必須? |
false |
位置は? |
named |
既定値 |
none |
パイプライン入力を許可する |
false |
ワイルドカード文字を許可する |
false |
<CommonParameters>
このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。
入力
入力型は、コマンドレットにパイプできるオブジェクトの型です。
出力
出力型は、コマンドレットによって生成されるオブジェクトの型です。
- ScriptCommandSetting
例
Example 1: Add a working directory setting to a script command
The first command gets the application profile object named SvcWebAppProfile01, and then stores the object in the $AppProfile variable.
The second command gets the script command object named PostInstall for the application profile stored in $AppProfile, and then stores it in the $ScriptCommand variable.
The third command creates a new script command setting that sets the working directory to Working_Folder_02, and then stores the object in the $ScriptSetting variable.
The last command updates the working directory for the script command stored in $ScriptCommand to be Working_Folder_02, which is the value of $ScriptSetting.
PS C:\> $AppProfile = Get-SCApplicationProfile -Name "SvcWebAppProfile01"
PS C:\> $ScriptCommand = Get-SCScriptCommand -ApplicationProfile $AppProfile | where {$_.Name -eq "PostInstall"}
PS C:\> $ScriptSetting = New-SCScriptCommandSetting -WorkingDirectory "Working_Folder_02"
PS C:\> Set-SCScriptCommand -ScriptCommand $ScriptCommand -ScriptCommandSetting $ScriptSetting