Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

New-SCScriptCommandSetting

Updated: November 1, 2013

Applies To: System Center 2012 R2 Virtual Machine Manager

New-SCScriptCommandSetting

Creates a settings object for a script command.

Syntax

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>]




Detailed Description

The New-SCScriptCommandSetting cmdlet creates a settings object for a script command.

Parameters

-AlwaysReboot<Boolean>

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CommandMayReboot

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FailOnMatch

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MatchExitCode<String>

Specifies the failure policy exit code.

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MatchRebootExitCode<String>

Specifies the restart policy match exit code.

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MatchStandardError<String>

Specifies the failure policy standard error.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MatchStandardOutput<String>

Specifies the failure policy standard output.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PersistStandardErrorPath<String>

Specifies the file path to store the standard error.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PersistStandardOutputPath<String>

Specifies the file path to store the standard output.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RestartOnRetry<Boolean>

Specifies that 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-ScriptCommandSetting or Set-SCScriptCommandSetting.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RestartScriptOnExitCodeReboot<Boolean>

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WarnAndContinueOnMatch

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WorkingDirectory<String>

Specifies a working directory for a script command.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • ScriptCommandSetting

Examples

1: Add a working directory setting to a script command.

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 object named PostInstall for the application profile stored in $AppProfile.

The third command creates a new script command setting which 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 (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

Related topics

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.