Share via


How to View the Configuration Manager Client Properties

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

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

  1. Get the Configuration Manager client Control Panel manager object (CPAppletMgr).

  2. From CPAppletMgr, call GetClientProperties to retrieve a collection of Configuration Manager client properties.

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

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

Concepts

About Configuration Manager Control Panel Configuration
Configuration Manager Client Control Panel Configuration
How to Run a Configuration Manager Client Action
How to View the Configuration Manager Client Components
How to Call Configuration Manager COM Automation Objects