Script [SPFSDK][VMROLE]
Applies To: Windows Azure Pack
The Script object represents a command-line executable that is run when a Windows-based virtual machine is provisioned. This object combines many of the properties from the following Windows PowerShell cmdlets in System Center 2012 R2 Virtual Machine Manager (VMM):
Add-SCScriptCommand
https://go.microsoft.com/fwlink/?LinkID=308898New-SCScriptCommandSetting
https://go.microsoft.com/fwlink/?LinkID=308899Set-SCScriptCommandSetting
https://go.microsoft.com/fwlink/?LinkID=308900
Type Hierarchy
ResourceExtension [SPFSDK][VMROLE].ExtensionSettings [SPFSDK][VMROLE].ApplicationProfile.WindowsApplicationProfile [SPFSDK][VMROLE].Script
Syntax
{
"AlwaysReboot": false,
"ApplicationPayloadId": string,
"DeploymentOrder": integer,
"ErrorPolicy": string,
"ExecutableAndParams": {
"Executable": string,
"Parameters": string,
},
"ExitCodeRegex": string,
"MaxOutputSize": integer,
"RebootExitCodeRegex": regex string,
"RestartOnRetry": boolean,
"RestartOnExitCodeReboot": boolean,
"ScriptBlock": string,
"ScriptCredential": credential string
"ScriptType": string,
"StandardErrorPath": string,
"StandardErrorRegex": regex string,
"StandardInput": string,
"StandardOutputPath": string,
"StandardOutputRegex": regex string,
"TimeoutInSeconds": integer,
"WorkingDirectory": string
}
Properties
Name |
Type |
Required |
Default value |
Description |
---|---|---|---|---|
AlwaysReboot |
Boolean |
No |
None |
If true, indicates that a restart should be initiated after the script ends successfully. |
ApplicationPayloadID |
String |
No |
None |
The identifier of an ApplicationProfile.ApplicationPayload item. This payload must point to a folder and can contain the script to be run. This property is not used when the ScriptType property is set to one of the following values:
|
DeploymentOrder |
Int |
No |
None |
The order in which to run this script command. This property is only used when the ScriptType property is set to one of the following values:
|
ErrorPolicy |
String |
Yes |
None |
The policy that handles an error that is returned by the exit code of the script. The allowed values are:
|
ExecutableAndParams |
ExecutableAndParams |
Maybe |
None |
The executable to run. Either this property or the ScriptBlock property must be declared, but never both. |
ExitCodeRegEx |
String |
No |
[1-9][0-9]* |
A regular expression that is used to determine error exit codes from the script. |
RebootExitCodeRegEx |
String |
No |
None |
A regular expression that is used to determine restart exit codes from the script. |
RestartOnRetry |
Boolean |
Yes |
None |
If true, indicates that this script can be rerun when the parent application is run after this script has failed and the virtual machine is repaired. |
RestartOnExitCodeReboot |
Boolean |
No |
None |
If true, indicates that the script should be rerun after the machine has been rebooted. The script reboots the machine when the exit code matches the exit codes that are specified by the RebootExitCodeRegEx property. |
ScriptBlock |
String |
Maybe |
None |
Inline Windows shell script commands. Either this property or the ExecutableAndParams property must be declared, but never both. |
ScriptCredential |
String |
No |
None |
The credential to use when the script is run, in a domain\username:password format. |
ScriptType |
String |
Yes |
None |
Determines when this script runs. The following values are allowed:
The Pre* and Post* ScriptTypes follow the System Center 2012 R2 Virtual Machine ManagerAppProfile-Level script command semantics. The OnProvision* ScriptTypes follow the Asymmetric Provision script command semantics. |
StandardErrorPath |
String |
No |
None |
The path to a file that should be used to capture the stderr stream. |
StandardErrorRegex |
String |
No |
None |
A regular expression that is compared against the stderr stream for errors. |
StandardInput |
String |
No |
None |
A string to pass into the stdin stream when the script is run. |
StandardOutputPath |
String |
No |
None |
The path to a file that should be used to capture the stdout stream. |
StandardOutputRegex |
String |
No |
None |
A regular expression that is compared against the stdout stream for errors. |
TimeoutInSeconds |
Int |
Yes |
None |
The number of seconds to wait until a time-out occurs. |
WorkingDirectory |
String |
No |
Windows System Directory |
The working directory to set for the process that is created by this Script object. |
ExecutableAndParams
For more information about the Windows PowerShell cmdlet Add-SCScriptCommand in Virtual Machine Manager that is used by this section, see https://go.microsoft.com/fwlink/?LinkID=308898.
Name |
Type |
Required |
Default value |
Description |
---|---|---|---|---|
Executable |
String |
Yes |
None |
The executable to run. |
Parameters |
String |
Yes |
None |
The parameters to pass to the executable. |
Remarks
The following code example provides a sample Script object.
{
"AlwaysReboot": false,
"ApplicationPayloadId": "49c1ccdb-9068-4b91-9409-0a7ca8a1d291",
"DeploymentOrder": 1,
"ErrorPolicy": "FailOnMatch",
"ExecutableAndParams": {
"Executable": "cmd.exe",
"Parameters": "/q /c msiexec sharepoint.msi"
},
"ExitCodeRegex": "[1-9][0-9]*",
"MaxOutputSize": 1048576,
"RebootExitCodeRegex": "{1641}|{3010}|{3011}",
"RestartOnRetry": false,
"ScriptBlock": null,
"ScriptCredential": "domain\\user:password",
"ScriptType": "PreInstall",
"StandardErrorPath": "c:\\err.txt",
"StandardErrorRegex": ".+",
"StandardInput": null,
"StandardOutputPath": "c:\\out.txt",
"StandardOutputRegex": null,
"TimeoutInSeconds": 900,
"WorkingDirectory": null
}
See Also
ApplicationProfile.WindowsApplicationProfile [SPFSDK][VMROLE]
SQLProfile [SPFSDK][VMROLE]
WebDeployApplication [SPFSDK][VMROLE]
SQLDacApplication [SPFSDK][VMROLE]
ScriptApplication [SPFSDK][VMROLE]