Edit

Share via


Get-CMDeviceCollectionVariable

Get a device collection variable.

Syntax

SearchByNameMandatory (Default)

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

SearchByValueMandatory

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

SearchByIdMandatory

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.

Parameter properties

Type:IResultObject
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchByValueMandatory
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchByIdMandatory
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 get its variables.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SearchByNameMandatory
Position:Named
Mandatory:True
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

-VariableName

Specify the name of a collection variable to get.

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

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

None

Outputs

IResultObject

IResultObject

Notes

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