Edit

Share via


New-CMTSStepConditionRegistry

Create a registry setting condition for a task sequence step.

Syntax

Default (Default)

New-CMTSStepConditionRegistry
    -RegistryKey <String>
    -RegistryOperator <VariableOperatorType>
    [-RegistryValueData <String>]
    [-RegistryValueName <String>]
    -RootKey <RegistryRootKeyType>
    [-ValueType <RegistryValueType>]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Use this cmdlet to create a registry setting 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

This example first creates the condition object for the registry setting that checks the Configuration Manager client log level.

It then uses the Set-CMTSStepSetDynamicVariable cmdlet to add this condition object to the Set Dynamic Variables step of the Default OS deployment task sequence.

$root = "HKeyLocalMachine"
$key = "SOFTWARE\Microsoft\CCM\Logging\@Global"
$name = "LogLevel"
$type = "RegistryDWord"
$value = 1

$condition = New-CMTSStepConditionRegistry -RootKey $root -RegistryKey $key -RegistryOperator Equals -RegistryValueName $name -ValueType $type -RegistryValueData $value

$tsNameOsd = "Default OS deployment"
$tsStepNameDynVar = "Set Dynamic Variables"

Set-CMTSStepSetDynamicVariable -TaskSequenceName $tsNameOsd -StepName $tsStepNameDynVar -AddCondition $condition

This sample script creates the following condition on the step:

Registry "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CCM\Logging\@Global\LogLevel" (REG_DWORD) equals "1"

Parameters

-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

-RegistryKey

Specify the registry key path to check. For example, with the HKeyLocalMachine RootKey, you can specify the registry key SOFTWARE\Microsoft\CCM.

Parameter properties

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

Parameter sets

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

-RegistryOperator

Use this parameter to specify the operator for the task sequence to evaluate the registry value. If you use the Exists or NotExists values, then you don't need to use the RegistryValueData parameter.

Parameter properties

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

Parameter sets

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

-RegistryValueData

If you use a comparative RegistryOperator like Equals, use this parameter to specify the value data to evaluate. Use ValueType to specify the registry type.

Parameter properties

Type:String
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

-RegistryValueName

Specify the name of the registry value to check. If you don't specify this parameter, the condition checks the (Default) value of the specified RegistryKey.

Parameter properties

Type:String
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

-RootKey

Specify the registry root key to check.

Parameter properties

Type:RegistryRootKeyType
Default value:None
Accepted values:HKeyCurrentUser, HKeyLocalMachine, HKeyUsers, HKeyCurrentConfig
Supports wildcards:False
DontShow:False

Parameter sets

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

-ValueType

Specify the type of registry value to check. Use this parameter with the RegistryValueData to specify the value data.

Parameter properties

Type:RegistryValueType
Default value:None
Accepted values:RegistrySZ, RegistryExpandSZ, RegistryDWord
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

-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_RegistryConditionExpression server WMI class.