By David Wiseman (Administrator)Created 14 Jun 2006, Modified 13 Aug 2006
My Rating:
Vote
Rating:
Not Rated
Views:7320
Downloads:232

List Exchange Mailbox stores

Language:  VBScript

Compatibility

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

Query active directory for a list of exchange mailbox stores.

Code

Line Numbers: On  Off      Plain Text
Set objRootDSE = CreateObject("LDAP://RootDSE")
configurationNamingContext = objRootDSE.get("configurationNamingContext")
   
Set cn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
Set rs = CreateObject("ADODB.Recordset")

cn.Open "Provider=ADsDSOObject;"
        
query = "<LDAP://" & configurationNamingContext & ">;(objectCategory=msExchPrivateMDB);name,cn,distinguishedName;subtree"

cmd.ActiveConnection = cn
cmd.CommandText = query
Set rs = cmd.Execute

While rs.EOF <> True And rs.BOF <> True
	wscript.echo rs.Fields("distinguishedname").Value
	rs.MoveNext
Wend
   
Set rs = Nothing
Set cmd = Nothing
Set cn = Nothing

 


Got a useful script? Click here to upload!


 

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