Set-SCScriptCommand

Set-SCScriptCommand

Configures a script command.

Syntax

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

Detailed Description

The Set-SCScriptCommand cmdlet configures a script command.

Parameters

-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

-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

-ScriptCommand<SCScriptCommand>

Specifies a script command object.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

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?

false

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

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

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

Example 1: Add a custom resource to a script command

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

The second command gets the script command object named PreInstall, and then stores the object in the $ScriptCommand variable.

The third command gets the resource object named CustomResource, and then stores the object in the $Resource variable.

The last command adds the resource object stored in $Resource to the script command object stored in $ScriptCommand.

PS C:\> $AppProfile = Get-SCApplicationProfile -Name "SvcWebAppProfile01"
PS C:\> $ScriptCommand = Get-SCScriptCommand -ApplicationProfile $AppProfile | Where {$_.Name -eq "PreInstall"}
PS C:\> $Resource = Get-SCCustomResource -Name "CustomResource.cr"
PS C:\> Set-SCScriptCommand -ScriptCommand $ScriptCommand -LibraryResource $Resource

Add-SCScriptCommand

Get-SCScriptCommand

Remove-SCScriptCommand

Get-SCApplicationProfile

Get-SCCustomResource