Set-SCScriptCommandSetting
設定指令碼命令設定。
Syntax
Set-SCScriptCommandSetting
[-ScriptCommandSetting] <SCScriptCommandSetting>
[-AlwaysReboot <Boolean>]
[-FailOnMatch]
[-WarnAndContinueOnMatch]
[-MatchExitCode <String>]
[-MatchStandardError <String>]
[-MatchStandardOutput <String>]
[-PersistStandardErrorPath <String>]
[-PersistStandardOutputPath <String>]
[-MatchRebootExitCode <String>]
[-RestartScriptOnExitCodeReboot <Boolean>]
[-WorkingDirectory <String>]
[-CommandMayReboot]
[-RestartOnRetry <Boolean>]
[<CommonParameters>]
Description
Set-SCScriptCommandSetting Cmdlet 會設定指令碼命令設定。
範例
範例 1:更新與指令碼命令相關聯的工作目錄
PS C:\> $AppProfile = Get-SCApplicationProfile -Name "SvcWebAppProfile01"
PS C:\> $ScriptCommand = Get-SCScriptCommand -ApplicationProfile $AppProfile | where {$_.Name -eq "PreInstall"}
PS C:\> $ScriptCmdSetting = Get-SCScriptCommandSetting -ScriptCommand $ScriptCommand
PS C:\> Set-SCScriptCommandSetting -ScriptCommandSetting $ScriptCmdSetting -WorkingDirectory "Working_Folder_03"
PS C:\> Set-SCScriptCommand -ScriptCommand $ScriptCommand -ScriptCommandSetting $ScriptCmdSetting
第一個命令會取得名為 SvcWebAppProfile01 的應用程式佈建檔物件,並將物件儲存在$AppProfile變數中。
第二個命令會針對儲存在 $AppProfile 的應用程式佈建檔取得名為 PreInstall 的指令碼命令,然後將物件儲存在$ScriptCommand變數中。
第三個命令會取得儲存在 $ScriptCommand 中的指令碼命令的指令碼命令設定物件,並將物件儲存在$ScriptCmdSetting變數中。
第四個命令會將工作目錄設定設為 Working_Folder_03。
最後一個命令會使用儲存在 $ScriptCmdSetting 中的設定,更新儲存在 $ScriptCommand 中的指令碼命令。
參數
-AlwaysReboot
指出腳本執行完成之後,電腦或虛擬機器應該一律重新開機。
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CommandMayReboot
表示指令碼命令可能會重新開機電腦或虛擬機器。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-FailOnMatch
表示在符合失敗原則時所採取的動作是失敗。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MatchExitCode
指定失敗原則結束代碼。
範例格式: -MatchExitCode "[1-9][0-9]*"
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MatchRebootExitCode
指定重新開機原則符合結束代碼。
範例格式: -MatchRebootExitCode "{1641}|{3010}|{3011}"
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MatchStandardError
指定失敗原則標準錯誤。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MatchStandardOutput
指定失敗原則標準輸出。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PersistStandardErrorPath
指定要儲存標準錯誤的檔案路徑。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PersistStandardOutputPath
指定要儲存標準輸出的檔案路徑。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RestartOnRetry
指出當與 New-SCScriptCommandSetting 或 Set-SCScriptCommandSetting搭配使用時,如果先前的工作失敗是因為腳本失敗而重新開機 VMM 作業時,腳本是否重新開機。
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RestartScriptOnExitCodeReboot
指出當符合結束代碼時,腳本會在電腦或虛擬機器重新開機之後重新開機。
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ScriptCommandSetting
指定指令碼命令設定物件。
Type: | SCScriptCommandSetting |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WarnAndContinueOnMatch
表示比對失敗原則時所採取的動作是警告使用者並繼續作業。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WorkingDirectory
指定指令碼命令的工作目錄。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
輸出
ScriptCommandSetting
此 Cmdlet 會傳回 ScriptCommandSetting 物件。