Delen via


Set-SCScriptCommandSetting

Configures a script command setting.

Syntax

Default (Default)

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

The Set-SCScriptCommandSetting cmdlet configures a script command setting.

Examples

Example 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.

Parameters

-AlwaysReboot

Indicates whether a computer or virtual machine should always restart after the script has finished running.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CommandMayReboot

Indicates that the script command may reboot the computer or virtual machine.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-FailOnMatch

Indicates that the action taken when a failure policy is matched is to fail.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MatchExitCode

Specifies the failure policy exit code.

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MatchRebootExitCode

Specifies the restart policy match exit code.

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MatchStandardError

Specifies the failure policy standard error.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MatchStandardOutput

Specifies the failure policy standard output.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PersistStandardErrorPath

Specifies the file path to store the standard error.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PersistStandardOutputPath

Specifies the file path to store the standard output.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RestartOnRetry

Indicates 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.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RestartScriptOnExitCodeReboot

Indicates whether the script restarts after the computer or virtual machine is restarted when an exit code is matched.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ScriptCommandSetting

Specifies a script command setting object.

Parameter properties

Type:SCScriptCommandSetting
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WarnAndContinueOnMatch

Indicates that the action taken when a failure policy is matched is to warn the user and continue the operation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WorkingDirectory

Specifies a working directory for a script command.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Outputs

ScriptCommandSetting

This cmdlet returns a ScriptCommandSetting object.