This script is made for Jeff Doty.
What the script does:
- make a wmi connection to a given exchange server and create a list of the mailboxes and their size
The script is tested in an win2003/exchange2003 environment.
Follow the next steps to run the script (admin rights needed):
- copy and paste the script in your favorite text editor
- replace the string ‘srv001′ with the name of your exchange server
- save the script (for example c:tempmailboxes.vbs)
- open a command prompt
- go to “c:temp”
- give “cscript mailboxes.vbs” (without quotes) and enter
When you want the output in a file please give this command:
“cscript mailboxes.vbs > mailboxes.txt” (again without the quotes)
The script:
' Name : mailboxes.vbs
' Description : script to enumerate all mailboxes on a given Exchange server
' Author : dirk adamsky - deludi bv
' Version : 1.10 (changed/corrected based on input by Mike)
' Date : 23-03-2011
' Level: intermediate
strServer = "srv001"
Const MinimalSize = 2048 'size in MB
Set objWMIExchange = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & strServer & "/root/MicrosoftExchangeV2")
Set colExchangeMailboxes = objWMIExchange.InstancesOf("Exchange_Mailbox")
For Each objExchangeMailbox in colExchangeMailboxes
If (Left(objExchangeMailbox.StorageGroupName, 5) <> "Recov") And (Round(objExchangeMailbox.Size/1024,0) > MinimalSize) Then
Wscript.Echo objExchangeMailbox.MailboxDisplayName & " ; " &_
Round(objExchangeMailbox.Size/1024,0) & " MB"
End If
Next
Set colExchange_Mailboxes = Nothing
Set objWMIExchange = Nothing
When you have problems/questions please post a reply or give a ‘star’ rating.
Happy scripting.
Best regards,
Dirk Adamsky – Deludi BV
