New-CMTSStepConditionVariable

Create a task sequence variable condition for a task sequence step.

Syntax

New-CMTSStepConditionVariable
   -ConditionVariableName <String>
   [-ConditionVariableValue <String>]
   -OperatorType <VariableOperatorType>
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Use this cmdlet to create a task sequence variable condition object for a task sequence step. Then use one of the New-CMTSStep* or Set-CMTSStep* cmdlets with the Condition or AddCondition parameters. For example, Set-CMTSStepApplyDataImage.

For more information, see Use the task sequence editor: Conditions.

Note

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

Examples

Example 1: Default condition

This example shows how to recreate the default condition on the Restart in Windows PE step in an imaging task sequence. It adds the following condition: Task Sequence Variable _SMSTSInWinPE equals "false"

It then adds the condition to a step named Set Dynamic Variables in the task sequence named Default IPU.

$tscondition = New-CMTSStepConditionVariable -ConditionVariableName "_SMSTSInWinPE" -ConditionVariableValue "false" -OperatorType Equals

$tsname = "Default IPU"
$tsstep = "Set Dynamic Variables"

Set-CMTSStepSetDynamicVariable -TaskSequenceName $tsname -StepName $tsstep -AddCondition $tscondition

Parameters

-ConditionVariableName

Specify the name of the task sequence variable to evaluate. This variable name can be a built-in task sequence variable or a custom one that you created. For more information, see the reference of Task sequence variables in Configuration Manager.

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

-ConditionVariableValue

If you use a comparative OperatorType like Equals, then specify the value of the variable to evaluate in the condition.

Type:String
Aliases:Value
Position:Named
Default value:None
Required:False
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
Required:False
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
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OperatorType

Specify the operator type to evaluate the value of the variable in the condition. If you use Exists or NotExists, then the ConditionVariableValue parameter isn't required. For the other comparative operator types, use the ConditionVariableValue parameter to specify the value to compare.

Type:VariableOperatorType
Aliases:Condition
Accepted values:Exists, NotExists, Equals, NotEquals, Greater, GreaterEqual, Less, LessEqual, Like, NotLike
Position:Named
Default value:None
Required:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

IResultObject

Notes

For more information on this return object and its properties, see SMS_TaskSequence_VariableConditionExpression server WMI class.