Mailbox size (VBScript)

This code can be found in Chapter 5 of Exchange Server Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This script was originally published in the Exchange Cookbook,
' (http://www.exchangebookcook.com). Written by Paul Robichaux, 
' Missy Koslosky, and Devin Ganger. Redistributed with permission 
' of the publisher, O'Reilly & Associates.

' 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
  

This code has been viewed 4176 times.

New from the creators of TechTasks.com: StatSheet.com