Set-CMDeviceCollectionVariable

Sets a device collection variable.

Syntax

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

Description

The Set-CMDeviceCollectionVariable cmdlet changes the settings of a device collection variable.

Examples

Example 1: Change a variable name

PS C:\> $Collection = Get-CMCollection -Name "Device"
PS C:\> Set-CMDeviceCollectionVariable -Collection $Collection -VariableName "testTS" -NewVariableName "NewVariable"

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

The second command changes the name of the collection variable testTS for the device collection stored in $Collection to NewVariable.

Example 2: Change a variable name by using the pipeline

PS C:\> Get-CMCollection -Name "Device" | Set-CMDeviceCollectionVariable -VariableName "testTS" -NewVariableName "NewVariable"

This command gets the device collection object named Device and uses the pipeline operator to pass the object to Set-CMDeviceCollectionVariable, which changes the name of the collection variable testTS for the device collection object to NewVariable.

Required Parameters

-CollectionId

Specifies the ID of a device collection.

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

Specifies the name of a device collection.

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

Specifies a device collection object. To obtain a collection object, use the Get-CMCollection cmdlet.

Type:IResultObject
Aliases:Collection
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-VariableName

Specifies the name of a collection variable.

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

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-DisableWildcardHandling

Indicates that wildcard handling is disabled.

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

Indicates that wildcard handling is enabled.

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

Indicates whether the collection variable value displays in the Configuration Manager console.

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

Specifies a new name for the collection variable.

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

Specifies a new value for the collection variable.

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

Shows what would happen if the cmdlet runs. The cmdlet is not run.

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