SCRIPT: Show mailbox quotas (including Store & Policy quotas)

by Bharat Suneja

I had earlier posted a script that lists users’ mailbox limits/quotas [read previous post “SCRIPT: Show mailbox limits“]. That script only picks up users who have their mailbox limits set individually, bypassing the “normal” users who have their mailbox storage limits set by the Store or a System Policy.

A related script that resets the mailbox storage limits of all such users who have it set individually – SCRIPT: Reset mailbox limits.

Here’s another one on those lines – this script lists mailbox storage limits for *all users*, even if set by the Store or a System Policy. In case it is set by the Store, it displays the quota set by the Store. If a System Policy is applied to the Store (on which the mailbox resides) to enforce mailbox storage limits, it displays limits enforced by the Policy.

The script can output results to a file – use the /f:

checkmailboxquotas.vbs /f:c:\docs\Quotas.txt

You can also compress console output (the actual mailbox limit data – run-time info will still be output to the console. This shows which Store it is connecting to, et al.. ).

It was a little harder to code than it appears from the description above. :) Want to know more about the things I tried? Read previous post “Conflicting Mailbox Store Policies“)

If for some reason it doesn’t work for you, please post the issue in comments for this post.

Disclaimer: View all downloaded code/scripts with suspicion, including mine. Try them in a test environment first. I (or whoever posts such scripts on the web) could just as easily include code that deletes all your recipients and other AD objects :). These scripts do not come with any warranties or support, nor confer any rights.

{ 13 comments… read them below or add one }

Ingi May 21, 2007 at 2:40 am

Hi
I tryed your script but came up with error on line 188,17
Set objUser = GetObject(“LDAP://” & objUsersRS.Fields(“distinguishedName”) & “”)

and it didn’t create the output file, but I could see it checked the policy limits on the exchange servers, and failed when was checking for user settings(stage 2).

Ingi

Reply

Lewis June 26, 2007 at 6:29 am

Thank you for your script on mailbox quotas! I’m not a great scripter at all, but I made a couple of adjustments to fit in my own environment and it worked very well. In part anyway..

I’d like to extend it to child domains. We have a relatively complex environment, where the Exchange servers are all part of a root domain, with the majority of users, but have some user accounts in child domains. (Without getting into details, think politics as the reason…) I have been unable to get the script modified in such a way as to drill down into a child domain for the user account portion. I’m not a great scripter,as I mentioned, but I assume that the second, user section is where I need to make changes. Do you have any ideas?

Also, because of our naming conventions, we have multiple message stores with identical names, so I couldn’t use the CN value when populating the dictionary results, but had to use the full DN to get uniqueness. Not a biggie, but thought I would mention it.

And finally, I used your script in conjunction with another to fulfill a request by my supervisor for a list of all mail accounts, size, last logon, and quota values. Unfortunately, the two scripts are enough different and produce output differently, that combining the results meant a lot of manual cleanup and merging spreadsheets. Do you have any ideas on how to script this all together? It seems like such a simple request from my supervisor, until you start figuring out all the places that information is being stored…

Again, thanks for sharing your great ideas!

Lewis

Reply

Bharat Suneja June 26, 2007 at 7:50 am

The URL that talks about searching AD and referral chasing is incorrect in the previous response. Here’s the correct one:
http://www.microsoft.com/technet/scriptcenter/guide/sas_ads_emwf.mspx?mfr=true

Reply

Bharat Suneja June 26, 2007 at 8:01 am

When I originally created these scripts, getting objects from one Domain was all I needed. If you have more than one domain, and the attribute(s) are replicated to a Global Catalog (part of partial replica), you can simply modify the LDAP search strings to start with GC://.

If you need to go after attributes not replicated to GCs, you will need to do some referral chasing. This is described and illustrated here:
http://snipr.com/1nkp8

Look at listing 5.32: The first line stores the value &h20; for the variable ADS_CHASE_REFERRALS_SUBORDINATE (a string, that we can later use more conveniently than its value, though I personally prefer shorter strings). Later in the script, look at the line:
objCommand.Properties(“Chase Referrals”) = ADS_CHASE_REFERRALS_SUBORDINATE

Common sense dictates referral chasing is more expensive than getting all the data from one source, either a single DC or GC.

I thought about including the mailbox size in this script but didn’t have the time (or the need back then) to add it.

You can easily get mailbox sizes using the Exchange_Mailbox WMI class:
http://msdn2.microsoft.com/en-us/library/aa143732.aspx

Thanks for pointing out the CN issue in dictionary causes problems.

I’ve increasingly less time for creating new scripts, and I suspect something similar may already exist out there. If not, sounds like a fun Sunday afternoon project that won’t happen this summer, if ever. :)

Reply

Anonymous August 21, 2007 at 11:10 am

is there a way to have the user email address proxy in the output as well ? basically, the script worked great, hoping to get user email address as well.

Reply

Bharat Suneja August 21, 2007 at 11:18 am

Adding user’s proxyAddresses is relatively easy. I have other scripts posted that list user’s email addresses – you can simply cut and paste the relevant snippets from that one into this script.

Remember proxyAddresses is a multi-valued attribute. You need to enumerate through each value.

Reply

Anonymous March 7, 2008 at 8:41 am

Hi,

I tried your script but didn;t work on my envi. I have error message ” table doesn’t exist, line 48, char 8″
FYI, last time, I used your previous script “showmailboxlimits.vbs” and it’s okay. But it didn’t show me the all user mailbox/storage limit including the default setting.

I look forward your answer

tks

roy

Reply

rolle July 10, 2008 at 2:18 am

I get the same result as the previous poster. Here is my complete output:
———————————–
C:\>cscript showmailboxquotas.vbs /f:C:\Quotas.txt
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

LDAP://DC=ad,DC=sogeti,DC=se
C:\showmailboxquotas.vbs(48, 8) Provider: Table does not exist.
———————————–

As a side note, I tried the other script as well (showMailboxLimits.vbs) It run fine, but it gave no results:
“No users with individual mailbox limits found!” (there are plenty of users with individual limits set.)

I think that the problem here is that I run the script from a server in a subdomain to to the enterprise root domain (even though the output shows the name of the child domain). Because when I run both scripts in another environment with only a single domain it works well.

So, how exactly can I modify the script so that it only runs for objects in my child domain?

Reply

Bharat Suneja July 10, 2008 at 10:41 am

@rolle: Scroll up above in the comments and look at the one about referral chasing. Most scripts on this web site do not include referral chasing – they’ll run in the logged-in domain.

Reply

Bosco Joseph October 9, 2008 at 10:09 am

Is there a way for mailbox quotas set for individual mailboxes to revert back to use mailbox store quotas in Exchange 2007.

We migrated from exhange 2003 to exchange 07 with higher mailbox quotas and some of the 03 users had custom mailbox quotas, we now have a bigger mailbox in 07 and want all users of 07 to use the default exchange 2007 mailbox store quotas.
pls advice

Reply

Shahid April 13, 2010 at 8:32 pm

I want to export server specific mailbox size details along with their alloted Quota. Is it possilbe to get following details.

Mailbox Current size, Limit, prohibit send, prohibit send/receive.

Reply

Anonyous August 23, 2010 at 8:13 am

The checkmailboxquotas.vbs is not posted on the site. Can you please poste it back on the site?

Reply

Bharat Suneja August 23, 2010 at 10:04 am

@Anonymous: Checked – the link works. It’s a zip file.

Reply

Leave a Comment

Previous post:

Next post: