Platform SDK: Active Directory, ADSI, and Directory Services

Listing the Exchange Server Version of all the Servers in the Organization

Dim ADOConn As ADODB.Connection
Dim ADOCommand As New Command
Dim RS As ADODB.Recordset

Set ADOConn = CreateObject("ADODB.Connection")
ADOConn.Provider = "ADSDSOObject"
ADOConn.Open "Active Directory Provider"

Set ADOCommand.ActiveConnection = ADOConn

ADOCommand.CommandText = _
        "<LDAP://Server>;( objectClass=Computer) _
        ;rdn, serialNumber;subtree"

Set RS = ADOCommand.Execute

While Not RS.EOF
        Debug.Print ("Server: " & RS.Fields(0) & _
        " Version: " & RS.Fields(1))
        RS.MoveNext
Wend

RS.Close

Set ADOConn = Nothing
Set ADOCommand = Nothing
Set RS = Nothing

Note: This example is specific to Exchange Server version 5.5 and below, and is not upwardly compatible with Exchange 6.0. Management and access of Exchange 6.0 Servers should be made through the CDO Exchange Management interfaces instead.