How to create a Mailbox Quota report

I just spent nearly an hour searching for a quick and dirty report of non-default quota limits placed on mailboxes on my Exchange cluster. I didn't need to know how much was in each mailbox, just what the quota limits were on each account. I found several VB scripts which didn't quite work in my environment and required administrator or Exchange service credentials.

The quota limits are kept in AD. Why not use an LDAP query to find the values, and, why not put it in a form which can be opened in Excel for sorting and searching? Here's the single command line answer:

csvde.exe -r "(objectClass=user)" -f UserQuotaReport.csv -n -l displayName,mail,mDBStorageQuota,mDBOverQuotaLimit,mDBOverHardQuotaLimit

(command line may be wrapped)

CSVDE.EXE is a built in Server 2003 tool which produces a comma separated text file. It is a single executable located in C:\Windows\System32 which can be copied from a server to a workstation. CSVDE.EXE -? gives fairly comprehensive help. Here's the switches I used:

-r = object class to search. I was only interested in user accounts.
-f = file name to dump the report to. If the filename or path has spaces, enclose it in quotes
-n = do not include binary values
-l = the fields to include in the report.

How did I know what the field names were? I simply ran:

csvde.exe -r "(objectClass=user)" -f UserQuotaReport.csv

This makes for a large report with many fields, but the first row in the report are the field names. Between the field names and the data in the fields, it's not difficult to pick which fields are useful. Note that every report will include the DistinguishedName (DN) as the first field.

Once I had my CSV, I opened it in Excel, deleted the DN column, sorted by mDBStorageQuota, mail, displayName. I deleted all the rows without a mail value, made a few changes so it looked pretty, saved it as an XLS file and handed it to my boss.

Sure, it's not something you'd want to do on a daily basis, but for a one-off report, or even once a month, it beats complicated VBS scripts - and, you can run it as a regular user. No special permissions needed.

Mark J.Lucas