I've written something similar, which despite taking a while (pauses
whilst doing the .recordcount) does work ok.  It takes the servername
from a CSV file previously opened.

Do objInputFile.AtEndOfStream <> True
        ' read in the Alias and the destination server from the csv file
        strServerName=objInputfile.readline
        Set objES=CreateObject("cdoexm.exchangeserver")
        Set objSG=CreateObject("cdoexm.storagegroup")
        objES.datasource.open(strServerName)
        objOutputFile.writeline "+++++++++++++++++++++++++++   " &
strServerName & "   +++++++++++++++++++++++++++" & vbCrlf
        objOutputFile.writeline "Version: " & objES.ExchangeVersion &
vbCrlf
        objOutputFile.writeline "Directory Server: " &
objES.DirectoryServer & vbCrlf
        For Each objStorageGroup In objES.StorageGroups
                objOutputFile.writeline "StorageGroup = " &
objStorageGroup & vbCrlf
                objSG.datasource.open objStorageGroup
                For Each objMailboxStore In objSG.mailboxstoredbs
                        intNumMailboxes=Enum_Mailboxes(objMailboxStore)
                        objOutputFile.writeline "Mailbox DB = " &
objMailboxStore & vbCrlf
                        objOutputFile.writeline "Number of mailboxes in
this mailbox store-:" & intNumMailboxes & vbCrlf        
                Next
        Next
        Set objES=Nothing
        Set objSG=Nothing       
Loop

Function Enum_Mailboxes(dn_homeMDB)

        Set objConnection = CreateObject("ADODB.Connection")
        objConnection.Open "Provider=ADsDSOObject;"
        Set objCommand = CreateObject("ADODB.Command")

        objCommand.ActiveConnection = objConnection
        objCommand.Properties("Page Size") = 200000
                
        objCommand.CommandText =
"<LDAP://dc=my,dc=domain,dc=com>;(&(objectCategory=User)(homeMDB=" &
dn_homeMDB & "));samAccountName;subtree"

        Set objRecordSet = objCommand.Execute
        
        enum_mailboxes = objRecordSet.RecordCount
        
        Set objRecordset = Nothing
        Set objCommand = Nothing
        Set objConnection = Nothing
        
End Function

_________________________________________________________________
List posting FAQ:       http://www.swinc.com/resource/exch_faq.htm
Web Interface: 
http://intm-dl.sparklist.com/cgi-bin/lyris.pl?enter=exchange&text_mode=&lang=english
To unsubscribe:         mailto:[EMAIL PROTECTED]
Exchange List admin:    [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to