This script uses WMI and Active Directory queries to return information about mailbox sizes from Exchange and the limits set in Active Directory.

Download GetMailboxStatistics.vbs

A number of people have been looking for Get-MailboxStatistics for Exchange 2003. I have a PowerShell version of this script for exactly that reason here.

This script is only intended for use with Exchange 2003. Exchange 2000 must use MAPI, Exchange 2007 has a PowerShell cmdlet, Get-MailboxStatistics, which can much more easily return this information.

It requires access to WMI on each Exchange Server, but does not require any of the Exchange System Tools. legacyExchangeDN is used to match accounts between AD and Exchange.

The script performs a number of searches in Active Directory. The largest number if multiple Admin Groups are selected (/a:”Admin Group*”). It can be instructed to use a single DC by specifying a name with the /dc switch. For forest-wide searches that must be a Global Catalog. If no DC is specified the script executes a DNS query for Global Catalog service records on the current forest name to attempt to find a (responding) GC in the current site, failing back to any GC in the forest otherwise.


[code lang=”plain”]
cscript GetMailboxStatistics.vbs [/o] [/s:]
[/a:”“] [/d:]
[/dc:] [/f:]

One of the following parameters must be specified:

/o Get statistics from all Exchange Servers in the organisation
This option overrides all others
/s Get statistics for this Exchange Server only
This option overrides all except /o
/a Get statistics from all Exchange Servers in the specified Administrative Group
/d Get statistics from all Exchange Servers in the specified Domain

The following parameters are optional:

/dc A Domain Controller to use for this process. Must be a Global Catalog
for reporting that covers a Forest. The script will attempt to find a
GC in the current site if not specified.
/f File Name for the output. Default file name is MailboxReport.csv

The following details are returned by this script:

  • Name
  • DN
  • AccountStatus (Enabled / Disabled)
  • UseDefaultQuotas (True / False)
  • Warn (in Mb, Warning Limit if specified on User Account)
  • ProhibitSend (in Mb, if specified on User Account)
  • ProhibitSendAndReceive (in Mb, if specified on User Account)
  • Size (in Mb)
  • TotalItems
  • MailboxStatus (BelowLimit, IssueWarning, ProhibitSend, NoChecking, MailboxDisabled)
  • AssocContentCount (Total Number of messages associated with the mailbox folders)
  • DeletedMessageSize (in Mb)
  • LastLoggedOnUser
  • LastLogon
  • LastLogoff
  • DateDeleted (for mailboxes which have been disconnected, waiting to be purged)
  • MailboxDisplayName
  • MailboxGuid
  • ServerName (Exchange Server)
  • StorageGroup
  • Store
  • legacyExchangeDN