How to Get the Unique Identifier Value for a Client
Updated: November 1, 2013
Applies To: System Center 2012 Configuration Manager, System Center 2012 Configuration Manager SP1, System Center 2012 R2 Configuration Manager
When you discover system resource data for a client, in System Center 2012 R2 Configuration Manager, you must specify the client's unique identifier value in the data discovery record (DDR), such as:
DDRAddString("SMS Unique Identifier",
"GUID:12345678-1234-1234-1234-123456789012", 64,
ADDPROP_GUID | ADDPROP_KEY);
The client's unique identifier can be found in Windows Management Instrumentation (WMI) at:
root\ccm:CCM_Client=@:ClientId
To identify the client's unique identifier in WMI
Connect to the CCM namespace (root\ccm).
Load the CCM_Client class.
Enumerate through the objects in the CCM_Client class and display the unique identifier (ClientId).
The following example method shows how obtain the client's unique identifier from WMI by connecting to the CCM namespace, loading the CCM_Client class and getting the ClientId property.
Important |
|---|
The following C# example requires the System.Management namespace. |
For information about calling the sample code, see How to Call a Configuration Manager Object Class Method by Using WMI
Sub GetClientUniqueID()
' Get a connection to the root\ccm namespace on the local system.
Set objWMIService = GetObject("winmgmts:\\.\root\ccm")
' Get all objects in the CCM_Client class.
set allCCMClientObjects = objWMIService.ExecQuery("Select * from CCM_Client")
' Loop through the available objects (only one) and display ClientId value.
For Each eachCCMClientObject in allCCMClientObjects
wscript.echo "ClientId (GUID): " & eachCCMClientObject.ClientId
Next
End Sub
public void GetClientUniqueID() { try { // Define the scope (namespace) to connect to. ManagementScope inventoryAgentScope = new ManagementScope(@"root\ccm"); // Load the class to work with (CCM_Client). ManagementClass inventoryClass = new ManagementClass(inventoryAgentScope.Path.Path, "CCM_Client", null); // Query the class for the objects (create query, create searcher object, execute query). ObjectQuery query = new ObjectQuery("SELECT * FROM CCM_Client"); ManagementObjectSearcher searcher = new ManagementObjectSearcher(inventoryAgentScope, query); ManagementObjectCollection queryResults = searcher.Get(); // Loop through the available objects (only one) and display the ClientId value. foreach (ManagementObject result in queryResults) { Console.WriteLine("ClientId (GUID): " + result["ClientId"]); } } catch (System.Management.ManagementException ex) { Console.WriteLine("Failed to get client ID (GUID). Error: " + ex.Message); throw; } }
This C# example requires:
System.Management
For more information about error handling, see About Configuration Manager Errors.
For more information about securing Configuration Manager applications, see Securing Configuration Manager Applications.
