Get-CMCollectionMember
Get members of a device or user collection.
Syntax
ByCollectionName (Default)
Get-CMCollectionMember
-CollectionName <String>
[-Name <String>]
[-ResourceId <Int32>]
[-SmsId <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[<CommonParameters>]
ByCollectionId
Get-CMCollectionMember
-CollectionId <String>
[-Name <String>]
[-ResourceId <Int32>]
[-SmsId <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[<CommonParameters>]
ByCollection
Get-CMCollectionMember
-InputObject <IResultObject>
[-Name <String>]
[-ResourceId <Int32>]
[-SmsId <String>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[<CommonParameters>]
Description
Use this cmdlet to get members of a collection. Collections can include devices or users, but not both. When you query a collection, this cmdlet returns objects for all members.
For more information, see Introduction to collections in Configuration Manager.
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 member of a collection by using the pipeline operator
This command first uses the Get-CMCollection cmdlet to get the collection object named UserCol1. It then uses the pipeline operator to pass the object to Get-CMCollectionMember, which gets all members in the collection. Finally, this example uses the Select-Object cmdlet to only display the member names.
Get-CMCollection -Name "UserCol1" | Get-CMCollectionMember | Select-Object Name
Example 2: Get a member of a collection by name
This command queries the collection DeviceCol1 for members that have a name beginning with domain
. The asterisk (*
) wildcard matches multiple characters. So results can include names such as "domain1" or "domain-controller".
Get-CMCollectionMember -CollectionName "DeviceCol1" -Name "domain*"
Example 3: Export collection details to a CSV
This example queries the XYZ0004B device collection for a set of properties and stores that in the variable, $collMem. The second line converts that data into comma-separated value (CSV) format, and outputs to a file.
$collMem = Get-CMCollectionMember -CollectionId "XYZ0004B" | Select-Object Name,Domain,LastLogonUser,DeviceOS,DeviceOSBuild,MACAddress,SerialNumber
$collMem | ConvertTo-Csv -NoTypeInformation | Out-File -FilePath "C:\output\XYZ0004B.csv"
Parameters
-CollectionId
Specify the ID of a collection to query. For example, "XYZ0004B"
.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByCollectionId
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 collection to query.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ByCollectionName
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 |
-InputObject
Specify a collection object to query. To get a collection object, use one of the following cmdlets:
You can also use the pipeline operator (|
) to pass a collection object to Get-CMCollectionMemeber on the command line.
Parameter properties
Type: | IResultObject |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | Collection |
Parameter sets
ByCollection
Position: | Named |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Name
To filter the results, specify the name of a resource in the collection. This filter isn't case-sensitive.
You can use wildcard characters:
*
: Multiple characters?
: Single character
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | True |
DontShow: | False |
Aliases: | ResourceName |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ResourceId
To filter the results, specify a resource ID. For example, 16777242
. The cmdlet only returns a record for that resource in the targeted collection.
Parameter properties
Type: | Int32 |
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 |
-SmsId
To filter the results, specify the SMSID of a resource. For example, "GUID:7a186367-7372-4841-889e-ba2e3aad1e85"
. This filter isn't case-sensitive.
You can use wildcard characters:
*
: Multiple characters?
: Single character
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | True |
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.