In Microsoft System Center Configuration Manager 2007, you view the Configuration Manager client properties by retrieving the properties collection from the CPAppletMgr object GetClientProperties method.
To view the Configuration Manager client properties
-
Get the Configuration Manager client Control Panel manager object (CPAppletMgr).
-
From CPAppletMgr, call GetClientProperties to retrieve a collection of Configuration Manager client properties.
-
Loop through the collection and display the property values.
Example
The following example method displays the Configuration Manager client properties.
For information about calling the sample code, see How to Call Configuration Manager COM Automation Objects.
Visual Basic Script | Copy Code |
---|---|
Sub ClientProperties On Error Resume Next Dim oCPAppletMgr' Control Applet manager object Dim oClientProperty ' Individual client property Dim oClientProperties ' A collection of client properties Dim iCount ' Get the Control Panel applet manager object. Set oCPAppletMgr=CreateObject("CPApplet.CPAppletMgr") If oCPAppletMgr Is Nothing Then WScript.Echo "Couldn't create control panel application manager" Exit Sub End If ' Get a collection of Properties. Set oClientProperties=oCPAppletMgr.GetClientProperties If oClientProperties Is Nothing Then WScript.Echo "Couldn't get the client components" Set oCPAppletMgr=Nothing Exit Sub End If WScript.Echo "There are " & oClientProperties.Count & " properties" WScript.Echo ' Display each client property. For iCount=1 to oClientProperties.Count Set oClientProperty=oClientProperties.item(iCount) WScript.Echo "Name: " & oClientProperty.Name WScript.Echo "Value: " & oClientProperty.Value WScript.Echo next Set oClientProperties=Nothing Set oCPAppletMgr=Nothing End Sub |
C# | Copy Code |
---|---|
public void ClientProperties() { try { CPAppletMgr cpAppletMgr = new CPAppletMgr(); ClientProperties clientProps = cpAppletMgr.GetClientProperties(); Console.WriteLine("There are " + clientProps.Count.ToString() + " properties"); Console.WriteLine(); foreach (ClientProperty clientProp in clientProps) { Console.WriteLine("Name: " + clientProp.Name); Console.WriteLine("Value: " + clientProp.Value); Console.WriteLine(); } } catch (COMException e) { Console.WriteLine("Error displaying properties: " + e.Message); throw; } } |
The example method has no parameters:
Compiling the Code
This C# example requires:
Namespaces
System
System.Collections.Generic
System.Text
System.Runtime.InteropServices
CPAPPLETLib
Assemblies
CPApplet 1.0 Type Library
Robust Programming
For more information about error handling, see About Configuration Manager Errors.
Security
For more information about securing Configuration Manager applications, see About Securing Configuration Manager Applications.
See Also
Tasks
How to Run a Configuration Manager Client ActionHow to View the Configuration Manager Client Components
Concepts
About Configuration Manager Control Panel ConfigurationHow to Call Configuration Manager COM Automation Objects
Other Resources
Configuration Manager Client Control Panel ConfigurationSend comments about this topic to Microsoft.