Edit

Share via


Get-CMTSStepConditionIfStatement

Get an if statement condition from a task sequence step.

Syntax

Default (Default)

Get-CMTSStepConditionIfStatement
    -InputObject <IResultObject>
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [<CommonParameters>]

Description

Use this cmdlet to get an if statement condition object from a task sequence step. You can use this object to:

  • View the details of the condition on the step.
  • Copy the condition to another task sequence step.

When you use the New-CMTSStep* or Set-CMTSStep* cmdlets, provide this condition object 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: View the details of an if statement condition

This example first gets the Default OS deployment task sequence, then gets the Set Dynamic Variables step. It passes the task sequence step object to this cmdlet to view the condition details.

$tsNameOsd = "Default OS deployment"
$tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast

$tsStepNameDynVar = "Set Dynamic Variables"
$tsStepDynVar = Get-CMTSStepSetDynamicVariable -InputObject $tsOsd -StepName $tsStepNameDynVar

Get-CMTSStepConditionIfStatement -InputObject $tsStepDynVar
SmsProviderObjectPath : SMS_TaskSequence_ConditionOperator
Operands              : {
                        instance of SMS_TaskSequence_FileConditionExpression
                        {
                                DateTime = NULL;
                                DateTimeOperator = NULL;
                                Path = "c:\test.txt";
                                Version = NULL;
                                VersionOperator = NULL;
                        };
                        }
OperatorType          : and

Example 2: Copy a condition to another step

This example first gets the Default OS deployment task sequence, then gets the Set Dynamic Variables step. It passes the task sequence step object to this cmdlet and saves the object in the $condition variable.

It then uses the Set-CMTSStepSetVariable cmdlet with the AddCondition parameter to add this same condition to the Set Task Sequence Variable step.

$tsNameOsd = "Default OS deployment"
$tsOsd = Get-CMTaskSequence -Name $tsNameOsd -Fast

$tsStepNameDynVar = "Set Dynamic Variables"
$tsStepDynVar = Get-CMTSStepSetDynamicVariable -InputObject $tsOsd -StepName $tsStepNameDynVar

$condition = Get-CMTSStepConditionIfStatement -InputObject $tsStepDynVar

$tsStepNameSetTSVar = "Set Task Sequence Variable"

Set-CMTSStepSetVariable -TaskSequenceName $tsNameOsd -StepName $tsStepNameSetTSVar -AddCondition $condition

Parameters

-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

-InputObject

Specify a task sequence step object with an if statement condition. To get this object, use one of the Get-CMTSStep cmdlets. For example, Get-CMTSStepApplyDataImage.

Parameter properties

Type:IResultObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:TaskSequenceStep

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
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

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

IResultObject

IResultObject

Notes

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