Share via


Creating an HTTP Virtual Server Across an Exchange Organization

Creating an HTTP Virtual Server Across an Exchange Organization

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The following example creates an HTTP virtual server on all computers across the organization that are running Microsoft® Exchange. The example uses functions for Getting a List of All Servers in the Administrative Group, Getting the Next Available Entry ID for a Server, Determining If the Specified Server Is a Front-End Server and Creating an HTTP Virtual Server.

Visual Basic

'//////////////////////////////////////////////////////////////////////
' Function: commitServer()
' Purpose:  Creates an HTTP virtual server on all Exchange machines across
'           the current organization.
'
' Input:    szAdminName                 Name of the virtual server to create.
'           szServerIP                  IP address of the server (can be blank).
'           szFrontEndIP                IP to assign this server on a Front End (can be blank).
'           szDefaultLogonDomain        The value for the default logon domain.
'           szHostingDomainName         The domain name of the hosted org this server will be used for (smtp address suffix).
'           szDomainName:               Domain of the Exchange organization.
'           szOrganizationName:         Name of the Exchange organization.
'           szAdministrativeGroupName:  Name of the Administrative group.
'           szUserName:                 Administrator username.
'           szUserPwd:                  Administrator password.
'
' Output:   None.
'
' Note:  In order for this example to function correctly, it may be necessary to include
' references to the following libraries: Active DS Type Library, Microsoft CDO for
' Exchange Management Library, Microsoft Cluster Service Automation Classes,
' Microsoft CDO for Windows 2000 Library.
'//////////////////////////////////////////////////////////////////////
Private Sub commitServer(ByVal szAdminName As String, _
                         ByVal szServerIP As String, _
                         ByVal szFrontEndIP As String, _
                         ByVal szHostHeader As String, _
                         ByVal szDefaultLogonDomain As String, _
                         ByVal szHostingDomainName As String, _
                         ByVal szDomainName As String, _
                         ByVal szOrganizationName As String, _
                         ByVal szAdministrativeGroupName As String, _
                         ByVal szUserName As String, _
                         ByVal szUserPwd As String)


    Dim szServers As String
    Dim szCurrentServer As String
    Dim szaServerList() As String
    Dim szEntryID As String
    Dim iCounter As Integer
    Dim isFrontEnd As Boolean

    ' Check input parameters.
    If szAdminName = "" Or szHostingDomainName = "" Or szDefaultLogonDomain = "" Or szDomainName = "" _
        Or szOrganizationName = "" Or szAdministrativeGroupName = "" Or szUserName = "" Or szUserPwd = "" Then
        Exit Sub
    End If

    'Get a list of the installed servers.
    getInstalledServerList szDomainName, _
                           szOrganizationName, _
                           szAdministrativeGroupName, _
                           szUserName, _
                           szUserPwd, _
                           szServers

    szaServerList = Split(szServers, ";", -1, 1)

    ' Create this virtual server for every server in the organization.
    For iCounter = 0 To UBound(szaServerList)
        szCurrentServer = szaServerList(iCounter)

        ' Get the next available entryid for the current server.
        getNextAvailableEntryID szDomainName, _
                                szOrganizationName, _
                                szAdministrativeGroupName, _
                                szCurrentServer, _
                                szUserName, _
                                szUserPwd, _
                                szEntryID

        ' Is this server a front end server?
        ' If so, send in szFrontEndIP instead of szServerIp.
        isFrontEndServer szDomainName, _
                         szOrganizationName, _
                         szAdministrativeGroupName, _
                         szCurrentServer, _
                         szUserName, _
                         szUserPwd, _
                         isFrontEnd

        If isFrontEnd Then
            createHTTPVirtualServer szDomainName, _
                                    szOrganizationName, _
                                    szAdministrativeGroupName, _
                                    szCurrentServer, _
                                    szDefaultLogonDomain, _
                                    szAdminName + " (" + szCurrentServer + ")", _
                                    szFrontEndIP, _
                                    szHostHeader, _
                                    szHostingDomainName, _
                                    szEntryID, _
                                    szUserName, _
                                    szUserPwd
        Else
            createHTTPVirtualServer szDomainName, _
                                    szOrganizationName, _
                                    szAdministrativeGroupName, _
                                    szCurrentServer, _
                                    szDefaultLogonDomain, _
                                    szAdminName + " (" + szCurrentServer + ")", _
                                    szServerIP, _
                                    szHostHeader, _
                                    szHostingDomainName, _
                                    szEntryID, _
                                    szUserName, _
                                    szUserPwd
        End If
    Next
End Sub

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.