VBScript to read exchange mailbox size using wmi
The below VBScript uses WMI to connect to the Exchange namespace (parameter 1 = server, 2 = output path). It iterates through all mailboxes on the server and writes the GUID and the Size to the mailboxsizereport.csv file.
dim fso
0set fso = CreateObject(“Scripting.FileSystemObject”)
strComputerName = wscript.arguments(0)
strOutputPath = wscript.arguments(1)
set output = fso.CreateTextFile(strOutputPath & “mailboxsizereport.csv”, True)
strE2K3WMIQuery = “winmgmts://” & strComputerName &_
“/root/MicrosoftExchangeV2”
Set mboxList = GetObject(strE2K3WMIQuery).InstancesOf(“Exchange_Mailbox”)
For each mailbox in mboxList
output.writeline mailbox.MailboxGUID & “;” & Round(mailbox.Size / 1024)
Next