Set-SCScriptCommand

Configures a script command.

Syntax

Set-SCScriptCommand
   [-ScriptCommand] <SCScriptCommand>
   [-Executable <String>]
   [-CommandParameters <String>]
   [-ScriptCommandSetting <SCScriptCommandSetting>]
   [-ScriptType <ScriptCommandType>]
   [-TimeoutSeconds <Int32>]
   [-StandardInput <String>]
   [-LibraryResource <CustomResource>]
   [-RunAsAccount <VMMCredential>]
   [-JobGroup <Guid>]
   [-DeploymentOrder <Int32>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [<CommonParameters>]

Description

The Set-SCScriptCommand cmdlet configures a script command.

Examples

Example 1: Add a custom resource to a script command

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

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 PreInstall and stores the object in the $ScriptCommand variable.

The third command gets the resource object named CustomResource and 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.

Parameters

-CommandParameters

Specifies the parameters for a script or executable program.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeploymentOrder

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

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Executable

Specifies the name of an executable program.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JobGroup

Specifies an identifier for a series of commands that runs as a set just before the final command that includes the same job group identifier runs.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JobVariable

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LibraryResource

Specifies a resource stored in the VMM library.

Type:CustomResource
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RunAsAccount

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

Type:VMMCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RunAsynchronously

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ScriptCommand

Specifies a script command object.

Type:SCScriptCommand
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ScriptCommandSetting

Specifies a script command setting object.

Type:SCScriptCommandSetting
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ScriptType

Specifies a script type. The acceptable values for this parameter are:

  • PreInstall
  • PostInstall
  • SaveState
  • RestoreState
  • PreService
  • PostService
  • PreUninstall
  • PostUninstall
Type:ScriptCommandType
Accepted values:PreService, PostService, SaveState, RestoreState, PreInstall, PostInstall, PreUninstall, PostUninstall, OrderedCommand, BareMetalPostWinPERegistration, OnProvisionFirst, OnProvisionRest, OnDeleteLast, OnDeleteRest, Install, BareMetalPostConfiguration, BareMetalPostUnattend
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-StandardInput

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TimeoutSeconds

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

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

ScriptCommand

This cmdlet returns a ScriptCommand object.