New-CMDeviceCollectionVariable
Create a device collection variable.
Syntax
New-CMDeviceCollectionVariable
-InputObject <IResultObject>
[-IsMask <Boolean>]
[-Value <String>]
-VariableName <String>
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-CMDeviceCollectionVariable
-CollectionId <String>
[-IsMask <Boolean>]
[-Value <String>]
-VariableName <String>
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-CMDeviceCollectionVariable
-CollectionName <String>
[-IsMask <Boolean>]
[-Value <String>]
-VariableName <String>
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Use this cmdlet to create a device collection variable. You can use a device collection variable to define custom task sequence variables and their associated values to be used by the devices in a collection. Task sequence variables are a set of name and value pairs that provide a mechanism to configure and customize the steps of a task sequence when the task sequence is deployed to a specific collection.
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: Create a device collection variable
The first command gets the device collection object named Device and stores it in the $Collection variable.
The second command creates a collection variable named testTS with the value test001 for the collection object stored in $Collection.
$Collection = Get-CMCollection -Name "Device"
New-CMDeviceCollectionVariable -Collection $Collection -VariableName "testTS" -Value "test001"
Parameters
-CollectionId
Specify the ID of a device collection on which to create the 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 on which to create the 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 on which to create the 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.
If you don't include this parameter, values aren't masked by default.
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Value
Specify a value for the collection variable.
Type: | String |
Aliases: | VariableValue |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VariableName
Specify a name for the collection variable to create.
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
IResultObject[]
IResultObject
Notes
For more information on this return object and its properties, see SMS_CollectionSettings server WMI class.