Trevor Sullivan's Tech Room

Minding the gap between administration and development

PowerShell / ConfigMgr: Retrieve List of Client Names by Collection ID

Posted by Trevor Sullivan on 2011/11/01

Here’s a simple PowerShell script that you can use to retrieve a list of system names based off of a collection ID in Microsoft System Center Configuration Manager (SCCM / ConfigMgr) 2007. This has not been tested against collections that contain anything except system resources (computers objects in SCCM). Use at your own risk.

# Variables
$SiteCode = '123';
$SccmServer = '';
$CollectionID = '12345678';

# Commands to retrieve client name list
$ClientList = Get-WmiObject -ComputerName $SccmServer `
    -Namespace "root\sms\site_$SiteCode" `
    -Class SMS_FullCollectionMembership `
    -Filter "CollectionID = '$CollectionID'" `
    -Property @('Name');
$ClientNames = $ClientList | Select-Object Name

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: