Set-CMDeviceCollectionVariable

Configure a device collection variable.

Syntax

Set-CMDeviceCollectionVariable
   -InputObject <IResultObject>
   [-IsMask <Boolean>]
   [-NewVariableName <String>]
   [-NewVariableValue <String>]
   -VariableName <String>
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMDeviceCollectionVariable
   -CollectionId <String>
   [-IsMask <Boolean>]
   [-NewVariableName <String>]
   [-NewVariableValue <String>]
   -VariableName <String>
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMDeviceCollectionVariable
   -CollectionName <String>
   [-IsMask <Boolean>]
   [-NewVariableName <String>]
   [-NewVariableValue <String>]
   -VariableName <String>
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Use this cmdlet to change a device collection variable.

Default collections can't have variables. Any collection that you target should have an ID that starts with the site code, not SMS.

For more information, see How to set task sequence 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: Change a variable name

The first command gets the device collection object named Device and stores it in the $Collection variable.

The second command changes the name of the collection variable testTS to NewVariable.

$Collection = Get-CMCollection -Name "Device"
Set-CMDeviceCollectionVariable -Collection $Collection -VariableName "testTS" -NewVariableName "NewVariable"

Example 2: Change a variable value

This command changes the value of the variable testTS on the Device collection. It sets the new variable value to 12.

Set-CMDeviceCollectionVariable -CollectionName "Device" -VariableName "testTS" -NewVariableValue 12

Parameters

-CollectionId

Specify the ID of a device collection to configure a variable. This value is the CollectionID property, for example, XYZ00012. Since you can't set variables on default collections, this value starts with the site code, not SMS.

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

-CollectionName

Specify the name of a device collection to configure a variable.

Type:String
Position:Named
Default value:None
Required:True
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:False
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

-InputObject

Specify a device collection object to configure a variable. To get this object, use the Get-CMCollection or Get-CMDeviceCollection cmdlets.

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

-IsMask

Set this parameter to $true to indicate that the variable value is hidden. Masked values aren't displayed in the Configuration Manager console, the Value property on the WMI class SMS_CollectionVariable, or the task sequence log file. The task sequence can still use the variable.

You can't unmask a variable once it's hidden. If you mask a variable's value, but then don't want it masked, you need to delete and recreate the variable.

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

-NewVariableName

Specify a new name for the collection variable. Use this parameter to rename the variable.

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

-NewVariableValue

Specify a new value for the collection variable.

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

-VariableName

Specify the name of the collection variable to change.

Type:String
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:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object

Notes

To set the variable priority, use the Set-CMCollection cmdlet with the VariablePriority parameter. To view the current variable priority, use the Get-CMCollectionSetting cmdlet.