Query for a mailbox’s size and quota

There are a lot of scripts out there to report a mailbox’s current size and others to report the quota for a mailbox.  And some might even do both, but for an entire domain, server, etc.  I wanted one that I could use to list a single mailbox’s current size and where it falls within its quota.

This script allows you to find a user based on login name (samAccountName) or email address.  If multiple matches are found it will report on all of them.  It uses WMI to query Exchange for the mailbox’s current size and then uses LDAP to determine the quota.  Since there are multiple places a quota can be set (system policy, server, mailbox), the script factors those in and backtracks to the resulting quota in effect.

The results are output to the screen and to a popup window.  And since it is nice to know, it also will display if default or custom limits are in use.  This script is nice because you don’t have to customize anything.  Just download\copy it and run it.

6 thoughts on “Query for a mailbox’s size and quota

  1. This is Great!! I translated it into C# so I could use it for a ASP.NET site and saved me a lot of time. Thanks a lot!

  2. Thanks and great script, Can you point me in the right direction in getting the script to display the Storage Group Name and Mail Store Name, aswell please.

    Thanks Steve

  3. The storage group and database name are implicitly known since they are contained in the homemdb attribute, which was retrieved in line 52. To parse that, convert the string into an array; the database will be at index 0, and the storage group at index 1. This code does it:

    arrHomeMdb = Split(homemdb, “,”)
    strDB = Mid(arrHomeMdb(0),4)
    strSG = Mid(arrHomeMdb(1),4)

    You can then add this information to the message box at line 138 (and to the shell output, if you want, at lines 135-137).

  4. A slight mod was required to get Scott’s storage group code to work:

    arrHomeMdb = Split(objResults.Fields(“homemdb”).value,”,”)
    strDB = Mid(arrHomeMdb(0),4)
    strSG = Mid(arrHomeMdb(1),4)

Leave a Reply

Your email address will not be published. Required fields are marked *

*