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 Configuration Manager client component information by retrieving the components collection from the CPAppletMgr object GetClientComponents method.
To view the Configuration Manager client components
- Get the Configuration Manager client Control Panel manager object (CPAppletMgr). 
- From CPAppletMgr, call GetClientComponents to retrieve a collection of Configuration Manager client components. 
- Loop through the collection and display the component information. 
Example
The following example method gets the Configuration Manager client components and displays information about each one.
For information about calling the sample code, see How to Call Configuration Manager COM Automation Objects.
Sub DisplayClientComponents 
    On Error Resume Next
    
    Dim oCPAppletMgr ' Control Applet manager object
    Dim oClientComponent ' Individual client component
    Dim oClientComponents ' A collection of client components
    ' 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 components.
    Set oClientComponents=oCPAppletMgr.GetClientComponents
    If oClientComponents Is Nothing Then
        wscript.echo "Couldn't get the client components"
        Set oCPAppletMgr=Nothing
        Exit Sub
    End If
    wscript.echo "There are " & oClientComponents.Count & " components"
    wscript.echo
    ' Display each client component.
    For Each oClientComponent In oClientComponents
        WScript.Echo oClientComponent.DisplayName 
        WScript.Echo "  Version: " & oClientComponent.Version
        WScript.StdOut.Write "  State: " 
        Select Case oClientComponent.State
            case 0  
                Wscript.Echo "Installed"
            case 1 : 
                WScript.Echo "Enabled"
            case 2 :
                WScript.Echo "Disabled"
        End Select
        Script.Echo 
    Next
    Set oClientComponents=Nothing
    Set oCPAppletMgr=Nothing
End Sub
public void DisplayClientComponents()
{
    try
    {
        CPAppletMgr cpAppletMgr = new CPAppletMgr();
        // Get the client components.
        ClientComponents clientComponents = cpAppletMgr.GetClientComponents();
        // Display client component information.
        foreach (ClientComponent component  in clientComponents)
        {
            Console.WriteLine(component.DisplayName);
            Console.WriteLine("  Version: " + component.Version);
            Console.Write("  State: ");
            switch (component.State)
            {
                case EComponentState.COMPONENT_STATE_INSTALLED:
                    Console.WriteLine("Installed");
                    break;
                case EComponentState.COMPONENT_STATE_ENABLED:
                    Console.WriteLine("Enabled");
                    break;
                case EComponentState.COMPONENT_STATE_DISABLED:
                    Console.WriteLine("Disabled");
                    break;
            }
            
            Console.WriteLine();
        }
    }
    catch (COMException e)
    {
        Console.WriteLine("Error displaying components: " + 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 Properties
How to Call Configuration Manager COM Automation Objects