How to Get and Set the Current Management Point for a Configuration Manager Client

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

You get the current management point for a Configuration Manager 2007 client by calling the SMSClientClass object SetCurrentManagementPoint method. You set the current management point for a client by calling the SMSClientClass object GetCurrentManagementPoint method.

Note

With SetCurrentManagementPoint you can set the management point with either the IP address or with the computer name of the management point.

To get and set the management point for a Configuration Manager client

  1. Get the Configuration Manager client configuration object (SMSClientClass).

  2. From the SMSClientClass object, call GetCurrentManagementPoint to get the client's current management point.

  3. From the SMSClientClass object, call SetCurrentManagementPoint to set the client's current management point.

Example

The following example method sets the management point for a Configuration Manager client by using the SMSClientClass object SetCurrentManagementPoint method. The example sets the management point by using the computer name. To set the management point with the IP address, you pass 1 (SmsClient_MPProtocolEnum.SmsClient_MPProtocol_OS) as the second parameter. The following example also displays the current and updated management point using GetCurrentManagmentPoint.

For information about calling the sample code, see How to Call Configuration Manager COM Automation Objects.

Sub SetCurrentManagementPoint (computerName)

    On Error Resume Next

    Dim oSMSClient

    Set oSMSClient = CreateObject ("Microsoft.SMS.Client")

    If Err.Number <>0 Then 
        WScript.Echo "Could not create SMS Client Object - quitting"
        Exit Sub
    End If

    WScript.Echo "Current Management Point is : " & _
        oSMSClient.GetCurrentManagementPoint

    ' Set management point to given computer name.
    oSMSClient.SetCurrentManagementPoint computerName,0

    WScript.Echo "Current Management Point is now : " & _
        oSMSClient.GetCurrentManagementPoint

    Set oSMSClient=Nothing

End Sub
public void SetCurrentManagementPoint(string computerName)
{
    try
    {
        SmsClientClass client = new SmsClientClass();

        Console.WriteLine("Current management point is: " + 
            client.GetCurrentManagementPoint());

        client.SetCurrentManagementPoint(computerName,
            _SmsClient_MPProtocolEnum.SmsClient_MPProtocol_OS);

        Console.WriteLine("Current management point is now: " + 
             client.GetCurrentManagementPoint());
    }
    catch (COMException e)
    {
        Console.WriteLine("Failed to set the management point " + e.Message);
        throw;
    }
}

The example method has the following parameters:

Parameter Type Description

newSite

  • Managed: String

  • VBScript: String

  • The new management point for the client.

Compiling the Code

This C# example requires:

Namespaces

System

System.Collections.Generic

System.Text

System.Runtime.InteropServices

SmsClientLib

Assembly

SmsClientLib

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 Client Configuration
Configuration Manager Client Configuration
How to Get and Set the Assigned Site for a Configuration Manager Client
SmsClient Client COM Automation Class
How to Call Configuration Manager COM Automation Objects