By David Wiseman (Administrator)Created 14 Jan 2006, Modified 13 Aug 2006
My Rating:
Vote
Rating:
Not Rated
Views:6617
Downloads:126

List Exchange Servers

Language:  VBScript

Compatibility

Windows XP Yes Windows 2003 Yes
Windows 2000 Unknown Windows NT Unknown
Vista Unknown Windows 2008 Unknown
Description

Searches Active Directory for a list of exchange servers

Code

Line Numbers: On  Off      Plain Text
set cn = createobject("ADODB.Connection")
set cmd = createobject("ADODB.Command")
set rs = createobject("ADODB.Recordset")

set objRoot = getobject("LDAP://RootDSE")
configurationNC = objRoot.Get("configurationnamingcontext")

cn.open "Provider=ADsDSOObject;"
cmd.activeconnection = cn

cmd.commandtext = "<LDAP://" & configurationNC & _
		  ">;(objectCategory=msExchExchangeServer);name;subtree"
set rs = cmd.execute

while rs.eof<>true and rs.bof<>true
	wscript.echo rs(0)
	rs.movenext
wend

cn.close

 


Got a useful script? Click here to upload!


 

  Post Comment
Order By:  
User Comments
      
Be the first to post a comment!