Edit

Share via


New-CMTSStepConditionVariable

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

Syntax

Default (Default)

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Variable

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ConditionVariableValue

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Value

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableWildcardHandling

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ForceWildcardHandling

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:VariableOperatorType
Default value:None
Accepted values:Exists, NotExists, Equals, NotEquals, Greater, GreaterEqual, Less, LessEqual, Like, NotLike
Supports wildcards:False
DontShow:False
Aliases:Condition

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

IResultObject

Notes

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