' This script was originally published in the Exchange Cookbook,
' (http://www.exchangebookcook.com). Written by Paul Robichaux,
' Missy Koslosky, and Devin Ganger. Redistributed with permission
' of the publisher, O'Reilly & Associates.
' This code searches Active Directory for Exchange servers
' ------ SCRIPT CONFIGURATION ------
strBase = "<LDAP://cn=microsoft exchange,cn=services,cn=configuration,dc=<domain>,dc=<TLD>;"
' e.g. " dc=robichaux, dc=net"
' ------ END CONFIGURATION ---------
strFilter = "(objectCategory=msExchExchangeServer);"
strAttrs = "cn;"
strScope = "subtree"
Set objConn = CreateObject("ADODB.Connection")
objConn.Open "Provider=ADsDSOObject;"
Set objRS = objConn.Execute(strBase & strFilter & strAttrs & strScope)
objRS.MoveFirst
While Not objRS.EOF
wscript.echo objRS.Fields(0).Value
objRS.MoveNext
Wend
|