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

Add-SCScriptCommand

Updated: November 1, 2013

Applies To: System Center 2012 R2 Virtual Machine Manager

Add-SCScriptCommand

Adds a script command to an application profile, application deployment, or host profile.

Syntax

Parameter Set: ApplicationDeployment
Add-SCScriptCommand -ApplicationDeployment <ApplicationDeployment> -ScriptType <ScriptCommandType> {PreService | PostService | SaveState | RestoreState | PreInstall | PostInstall | PreUninstall | PostUninstall | OrderedCommand | OnProvisionFirst | OnProvisionRest | OnDeleteLast | OnDeleteRest | Install} [-CommandParameters <String> ] [-DeploymentOrder <Int32> ] [-Executable <String> ] [-JobVariable <String> ] [-LibraryResource <CustomResource> ] [-PROTipID <Guid> ] [-RunAsAccount <VMMCredential> ] [-RunAsynchronously] [-ScriptCommandSetting <SCScriptCommandSetting> ] [-StandardInput <String> ] [-TimeoutSeconds <Int32> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: ApplicationProfile
Add-SCScriptCommand -ApplicationProfile <ApplicationProfile> -ScriptType <ScriptCommandType> {PreService | PostService | SaveState | RestoreState | PreInstall | PostInstall | PreUninstall | PostUninstall | OrderedCommand | OnProvisionFirst | OnProvisionRest | OnDeleteLast | OnDeleteRest | Install} [-CommandParameters <String> ] [-DeploymentOrder <Int32> ] [-Executable <String> ] [-JobVariable <String> ] [-LibraryResource <CustomResource> ] [-PROTipID <Guid> ] [-RunAsAccount <VMMCredential> ] [-RunAsynchronously] [-ScriptCommandSetting <SCScriptCommandSetting> ] [-StandardInput <String> ] [-TimeoutSeconds <Int32> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: VMHostProfile
Add-SCScriptCommand -PhysicalComputerProfile <PhysicalComputerProfile> [-CommandParameters <String> ] [-DeploymentOrder <Int32> ] [-Executable <String> ] [-JobVariable <String> ] [-LibraryResource <CustomResource> ] [-PROTipID <Guid> ] [-RunAsynchronously] [-ScriptCommandSetting <SCScriptCommandSetting> ] [-StandardInput <String> ] [-TimeoutSeconds <Int32> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]




Detailed Description

The Add-SCScriptCommand cmdlet adds a script command to an application profile, application deployment, or host profile. A script command allows an Administrator to run code during deployment and servicing operations.

Parameters

-ApplicationDeployment<ApplicationDeployment>

Specifies an application deployment object.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-ApplicationProfile<ApplicationProfile>

Specifies an application profile object.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-CommandParameters<String>

Specifies the parameters for a script or executable program.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DeploymentOrder<Int32>

Specifies the order in which a computer tier, application host, or application is deployed.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Executable<String>

Specifies the name of an executable program.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

Specifies that job progress is tracked and stored in the variable named by this parameter.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LibraryResource<CustomResource>

Specifies a resource stored in the VMM library.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PhysicalComputerProfile<PhysicalComputerProfile>

Specifies a profile that is used to deploy an operating system to a computer.


Aliases

VMHostProfile

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-PROTipID<Guid>

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsAccount<VMMCredential>

Specifies a Run As account that contains credentials with permission to perform this action.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ScriptCommandSetting<SCScriptCommandSetting>

Specifies a script command setting object.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ScriptType<ScriptCommandType>

Specifies a script type. Valid values are: PreInstall, PostInstall, SaveState, RestoreState, PreService, PostService, PreUninstall, PostUninstall.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-StandardInput<String>

Specifies a path to a file that contains standard input information to use with the script command.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-TimeoutSeconds<Int32>

Specifies the amount of time, in seconds, that a process waits before timing out.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.


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.

  • ScriptCommand

Examples

1: Add a script command to an application profile.

The first command gets the application profile object named SvcWebAppProfile01 and stores the object in the $AppProfile variable.

The second command creates a script command setting object that sets the working directory to Payload, and then stores the object in the $ScriptSetting variable.

The last command adds a preinstall script command to the application profile stored in $AppProfile.


PS C:\> $AppProfile = Get-SCApplicationProfile -Name "SvcWebAppProfile01"PS C:\> $ScriptSetting = New-SCScriptCommandSetting -WorkingDirectory "Working_Folder_01"PS C:\> Add-SCScriptCommand -ApplicationProfile $AppProfile -Executable "startup.ps1" -ScriptType "PreInstall" -ScriptCommandSetting $ScriptSetting -TimeoutSeconds 120

Related topics

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