I am writing a program to gather information about an Exchange system.
I am having trouble determining the number of mailboxes in a store.
>From looking at the documentation, this appears to be fairly trivial
with the new WMI providers in Exchange 2003, however, I am running
Exchange 2000.  I have tried a number of ways to get this information.
Below is the code I am using to query the AD to count the mailboxes with
a particular homeMDB.  The query does not appear to run or return a
valid result set.  Can anyone see my problem, point me in the right
direction or have a code snippit that does this function.  (I am using
VB)




    Set objmailboxstoredb = CreateObject("cdoexm.mailboxstoredb")
    For Each urlmailboxstoredb In objstoragegroup.MailboxStoreDBs
' Get Mailbox Count
        Set objroot = GetObject("LDAP://RootDSE";)
        strdefaultdomainNC = objroot.get("DefaultNamingContext")
        Set objroot = Nothing
  
        Set objConnnection = CreateObject("ADODB.Connection")
        objConnnection.Provider = "ADsDSOObject"
        objConnnection.Open "Active Directory Provider"
' ------------------------------------------------------------
        Set objNamingContext = GetObject("LDAP://"; & strdefaultdomainNC)
        strADOQuery = "<LDAP://"; & objNamingContext & ">;" & _
                      "(&(objectClass-organizationalPerson)(homeMDB=" &
urlmailboxstoredb & "));ADsPath;subtree"
        Set objResultList = ADOconn.Execute(strADOQuery)
        CountMB = 0
        Do While Not objResultList.EOF
           CountMB = CountMB + 1
           objResultList.MoveNext
        Loop
        txtMailboxes.Text = Str(CountMB)
    Next

_________________________________________________________________
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