extracting mailbox info from active directory
I'm currently trying to extract info such as mailbox size and item count from all the users in the active directory.
So far I have used this code:
Code:
' This code lists the size of all mailboxes on the selected server.
' ------ SCRIPT CONFIGURATION ------
strComputerName = "<serverName>" ' e.g. "batman"
' ------ END CONFIGURATION ---------
strE2K3WMIQuery = "winmgmts://" & strComputerName &_
"/root/MicrosoftExchangeV2"
' Find each mailbox on the target server and report their
' item counts and sizes
Set mboxList = GetObject(strE2K3WMIQuery).InstancesOf("Exchange_Mailbox")
For each mailbox in mboxList
strOutput = ""
strOutput = "Mailbox: " & mailbox.MailboxDisplayName & vbCRLF
strOutput = strOutput & " " & mailbox.Size & "KB in " & mailbox.TotalItems &_
" items" & vbCRLF
WScript.Echo strOutput
Next
referenced from "http://techtasks.com/code/viewbookcode/1246"
I have replaced teh server name with my own server's name and so far, I get the error :
Code:
Error:Permission denied: 'GetObject'
Code: 800a0046
Any help would be appreciated ><