New-CMTSStepSetDynamicVariable

Create a Set Dynamic Variables step, which you can add to a task sequence.

Syntax

New-CMTSStepSetDynamicVariable
   -AddRule <IResultObject[]>
   [-Condition <IResultObject[]>]
   [-ContinueOnError]
   [-Description <String>]
   [-Disable]
   -Name <String>
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

This cmdlet creates a new Set Dynamic Variables step object. Use the New-CMTSRule cmdlet to define the rules for this step. Then use the Add-CMTaskSequenceStep cmdlet to add the step to a task sequence. For more information on this step, see About task sequence steps: Set Dynamic Variables.

Note

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

Examples

Example 1

This example first uses the New-CMTSRule cmdlet to create two rules.

It then creates an object for the Set Dynamic Variables step, and adds this rule.

Finally, it gets a task sequence object, and adds this new step to the task sequence at index 11.

$tsrule1 = New-CMTSRule -Variable @{'OSDDownloadDestinationLocationType' = 'TSCache'} -ReferencedVariableName "_SMSTSInWinPE" -ReferencedVariableOperator Equals -ReferencedVariableValue TRUE

$tsrule2 = New-CMTSRule -Variable @{'OSDMigrateUseHardlinks' = 'true'} -ReferencedVariableName "_SMSTSMediaType" -ReferencedVariableOperator NotEquals -ReferencedVariableValue "OEMMedia"

$step = New-CMTSStepSetDynamicVariable -Name "Set Dynamic Variables" -AddRule $tsrule1,$tsrule2

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

$tsOsd | Add-CMTaskSequenceStep -Step $step -InsertStepStartIndex 11

Parameters

-AddRule

Specify one or more rule objects. Rules define the criteria and variables to set when they evaluate true. To get this object, use the New-CMTSRule cmdlet. The order of the rules in the array determines the order in this step.

Type:IResultObject[]
Aliases:AddRules
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Condition

Specify a condition object to use with this step. To get this object, use one of the task sequence condition cmdlets. For example, Get-CMTSStepConditionVariable.

Type:IResultObject[]
Aliases:Conditions
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

-ContinueOnError

Add this parameter to enable the step option Continue on error. When you enable this option, if the step fails, the task sequence continues.

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

-Description

Specify an optional description for this task sequence step.

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

-Disable

Add this parameter to disable this task sequence step.

Type:SwitchParameter
Aliases:DisableThisStep
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

-Name

Specify a name for this step to identify it in the task sequence.

Type:String
Aliases:StepName
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_SetDynamicVariablesAction server WMI class.