Set-SCScriptCommandSetting

Configures a script command setting.

Description

The Set-SCScriptCommandSetting cmdlet configures a script command setting.

For more information about Set-SCScriptCommandSetting, type: "Get-Help Set-SCScriptCommandSetting".

Parameters

ScriptCommandSetting

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
Specifies a script command setting object.

AlwaysReboot

Required? false
Accept Pipeline Input? false
Position? named
Indicates whether a computer or virtual machine should always restart after the script has finished running.

CommandMayReboot

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the script command may reboot the computer or virtual machine.

FailOnMatch

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the action taken when a failure policy is matched is to fail.

MatchExitCode

Required? false
Accept Pipeline Input? false
Position? named
Specifies the failure policy exit code.

Example format: -MatchExitCode "[1-9][0-9]*"

MatchRebootExitCode

Required? false
Accept Pipeline Input? false
Position? named
Specifies the restart policy match exit code.

Example format: -MatchRebootExitCode "{1641}|{3010}|{3011}"

MatchStandardError

Required? false
Accept Pipeline Input? false
Position? named
Specifies the failure policy standard error.

MatchStandardOutput

Required? false
Accept Pipeline Input? false
Position? named
Specifies the failure policy standard output.

PersistStandardErrorPath

Required? false
Accept Pipeline Input? false
Position? named
Specifies the file path to store the standard error.

PersistStandardOutputPath

Required? false
Accept Pipeline Input? false
Position? named
Specifies the file path to store the standard output.

RestartScriptOnExitCodeReboot

Required? false
Accept Pipeline Input? false
Position? named
Indicates whether the script restarts after the computer or virtual machine is restarted when an exit code is matched.

WarnAndContinueOnMatch

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the action taken when a failure policy is matched is to warn the user and continue the operation.

WorkingDirectory

Required? false
Accept Pipeline Input? false
Position? named
Specifies a working directory for a script command.

Examples

1: Update the working directory associated with script command.
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
The first command gets the application profile object named SvcWebAppProfile01 and stores the object in the $AppProfile variable.

The second command gets the script command named PreInstall for the application profile stored in $AppProfile, and then stores the object in the $ScriptCommand variable.

The third command gets the script command setting object for the script command stored in $ScriptCommand and stores the object in the $ScriptCmdSetting variable.

The fourth command sets the working directory setting to Working_Folder_03.

The last command updates the script command stored in $ScriptCommand with the settings stored in $ScriptCmdSetting.

See Also