How to Create or Remove a Connector by Using the Operations Manager Class Libraries

System Center

Updated: May 22, 2009

Applies To: Operations Manager 2007 R2, Operations Manager 2007 SP1, System Center Operations Manager 2007

You can use the Operations Manager class libraries to create a connector that allows Operations Manager to communicate with an external system. If the external system runs on a Windows-based computer, using the class libraries is the preferred method for creating the connector.


The following example demonstrates how to create a connector and how to remove a connector by using the Operations Manager class libraries.

' Creates a new connector by using the Operations Manager 
' class libraries.
Imports System
Imports System.Collections.ObjectModel
Imports Microsoft.EnterpriseManagement
Imports Microsoft.EnterpriseManagement.ConnectorFramework
Imports System.IO
Imports System.Text
Imports System.Xml

Namespace SDKSamples
    Class Program
        Public Overloads Shared Function Main(ByVal args() As String) As Integer

            Dim mg As ManagementGroup = New ManagementGroup("localhost")

            Dim omcf As ConnectorFrameworkAdministration = _
            Dim connector As MonitoringConnector = Nothing
            Dim connectorId As Guid = Guid.NewGuid()

            ' Create a new connector.
            Dim myConnectorInfo As ConnectorInfo = New ConnectorInfo()
            myConnectorInfo.Name = "myConnector"
            myConnectorInfo.DisplayName = "My Connector"
            myConnectorInfo.Description = _
                "This connector was created using the Operations Manager class libraries."
            connector = omcf.Setup(myConnectorInfo, connectorId)
            Console.WriteLine("Created " & connector.Name & " with ID: " & connector.Id.ToString())

            ' Remove the connector when finished with it.
            Console.WriteLine("Removing " + connector.Name)
            Console.WriteLine("Connector removed.")
        End Function
    End Class
End Namespace

See Also