Get-CMDeviceCollectionVariable

Get a device collection variable.

Syntax

Get-CMDeviceCollectionVariable
   -CollectionName <String>
   [-VariableName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [<CommonParameters>]
Get-CMDeviceCollectionVariable
   -Collection <IResultObject>
   [-VariableName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [<CommonParameters>]
Get-CMDeviceCollectionVariable
   -CollectionId <String>
   [-VariableName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [<CommonParameters>]

Description

Use this cmdlet to get the task sequence variables on a device 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: Get a device collection variable by name

This command gets the collection variable named testTS for the device collection named Device.

Get-CMDeviceCollectionVariable -CollectionName "DeviceCollection02" -VariableName "testTS"

Example 2: Get all unmasked variables for a collection

This example gets all variables from the collection IT servers, and filters the list to only the variables that aren't hidden. It then shows the name and value for each variable in a table.

Get-CMDeviceCollectionVariable -CollectionName "IT servers" | Where-Object { -not $_.IsMasked } | Select-Object Name, Value

Parameters

-Collection

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

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

-CollectionId

Specify the ID of a device collection to get its variables. 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 get its variables.

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

-VariableName

Specify the name of a collection variable to get.

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

Inputs

None

Outputs

IResultObject[]

IResultObject

Notes

For more information on this return object and its properties, see SMS_CollectionVariable server WMI class.