Set-CMDeviceCollectionVariable
Configure a device collection variable.
Syntax
SetByValueMandatory (Default)
Set-CMDeviceCollectionVariable
-InputObject <IResultObject>
-VariableName <String>
[-IsMask <Boolean>]
[-NewVariableName <String>]
[-NewVariableValue <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SetByIdMandatory
Set-CMDeviceCollectionVariable
-CollectionId <String>
-VariableName <String>
[-IsMask <Boolean>]
[-NewVariableName <String>]
[-NewVariableValue <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SetByNameMandatory
Set-CMDeviceCollectionVariable
-CollectionName <String>
-VariableName <String>
[-IsMask <Boolean>]
[-NewVariableName <String>]
[-NewVariableValue <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
.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
SetByIdMandatory
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-CollectionName
Specify the name of a device collection to configure a variable.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
SetByNameMandatory
Position: | Named |
Mandatory: | True |
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: | False |
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 |
-InputObject
Specify a device collection object to configure a variable. To get this object, use the Get-CMCollection or Get-CMDeviceCollection cmdlets.
Parameter properties
Type: | IResultObject |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | Collection |
Parameter sets
SetByValueMandatory
Position: | Named |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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.
Parameter properties
Type: | Boolean |
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 |
-NewVariableName
Specify a new name for the collection variable. Use this parameter to rename the variable.
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 |
-NewVariableValue
Specify a new value for the collection variable.
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 |
-VariableName
Specify the name of the collection variable to change.
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 |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet doesn't run.
Parameter properties
Type: | SwitchParameter |
Default value: | False |
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
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.