New-CMTSStepRunPowerShellScript

Create the Run PowerShell Script step in a task sequence.

Syntax

New-CMTSStepRunPowerShellScript
   -Name <String>
   [-SuccessCode <Int32[]>]
   [-Condition <IResultObject[]>]
   [-ContinueOnError]
   [-Description <String>]
   [-Disable]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMTSStepRunPowerShellScript
   [-ExecutionPolicy <ExecutionPolicyType>]
   -Name <String>
   [-OutputVariableName <String>]
   [-Parameter <String>]
   -SourceScript <String>
   [-SuccessCode <Int32[]>]
   [-TimeoutMins <Int32>]
   [-UserName <String>]
   [-UserPassword <SecureString>]
   [-WorkingDirectory <String>]
   [-Condition <IResultObject[]>]
   [-ContinueOnError]
   [-Description <String>]
   [-Disable]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMTSStepRunPowerShellScript
   [-ExecutionPolicy <ExecutionPolicyType>]
   -Name <String>
   [-OutputVariableName <String>]
   -PackageId <String>
   [-Parameter <String>]
   -ScriptName <String>
   [-SuccessCode <Int32[]>]
   [-TimeoutMins <Int32>]
   [-UserName <String>]
   [-UserPassword <SecureString>]
   [-WorkingDirectory <String>]
   [-Condition <IResultObject[]>]
   [-ContinueOnError]
   [-Description <String>]
   [-Disable]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1

PS XYZ:\>

Parameters

-Condition
Type:IResultObject[]
Aliases:Conditions
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ContinueOnError
Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Description
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Disable
Type:SwitchParameter
Aliases:DisableThisStep
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ExecutionPolicy
Type:ExecutionPolicyType
Aliases:PowerShellExecutionPolicy
Accepted values:AllSigned, Undefined, Bypass
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name
Type:String
Aliases:StepName
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-OutputVariableName

Use this parameter to configure the following setting in the Run PowerShell Script task sequence step: Output to task sequence variable. Save the command output to a custom task sequence variable.

Type:String
Aliases:Output, OutputVariable
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PackageId
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Parameter
Type:String
Aliases:Parameters
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ScriptName
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SourceScript

{{ Fill SourceScript Description }}

Type:String
Aliases:SourceCode
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SuccessCode

{{ Fill SuccessCode Description }}

Type:Int32[]
Aliases:SuccessCodes
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TimeoutMins

{{ Fill TimeoutMins Description }}

Type:Int32
Aliases:TimeoutInMinutes
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-UserName

{{ Fill UserName Description }}

Type:String
Aliases:User
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-UserPassword

{{ Fill UserPassword Description }}

Type:SecureString
Aliases:Password
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet doesn't run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WorkingDirectory

{{ Fill WorkingDirectory Description }}

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

Inputs

None

Outputs

IResultObject