When you discover system resource data for a client, in Microsoft System Center Configuration Manager 2007, you must specify the client's unique identifier value in the data discovery record (DDR), such as:

  Copy Code
DDRAddString("SMS Unique Identifier",
			 "GUID:12345678-1234-1234-1234-123456789012", 64,

The client's unique identifier can be found in Windows Management Instrumentation (WMI) at:

  Copy Code


To identify the client's unique identifier in WMI
  1. Connect to the CCM namespace (root\ccm).

  2. Load the CCM_Client class.

  3. 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.

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


Visual Basic Script  Copy Code
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	 
End Sub
C#  Copy Code
public void GetClientUniqueID()
		// 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);


Compiling the Code

This C# example requires:



Robust Programming

For more information about error handling, see About Configuration Manager Errors.


For more information about securing Configuration Manager applications, see Securing Configuration Manager Applications.

See Also

Send comments about this topic to Microsoft.