• 1. London, UK
  • 2. Sydney, Australia
  • 3. New York, NY
  • 4. Melbourne, Australia
  • 5. Bellevue, WA
  • 6. Paris, France
  • 7. Moscow, Russia
  • 8. Chicago, IL
  • 9. San Francisco, CA
  • 10. Amsterdam, Netherlands

Wednesday, January 17, 2007

 

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

Posted by Bharat Suneja at 7:59 PM
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: switch with filename/path - e.g.

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.

Download ShowMailboxQuotas.zip

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.

Labels: ,

7 Comments:

May 21, 2007 2:40 AM
Anonymous Ingi said...

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

 
June 26, 2007 6:29 AM
Blogger Lewis said...

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

 
June 26, 2007 7:50 AM
Blogger Bharat Suneja said...

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

 
June 26, 2007 8:01 AM
Blogger Bharat Suneja said...

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. :)

 
August 21, 2007 11:10 AM
Anonymous Anonymous said...

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.

 
August 21, 2007 11:18 AM
Blogger Bharat Suneja said...

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.

 
March 7, 2008 8:41 AM
Anonymous Anonymous said...

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

 

Post a Comment

Links to this post:

Create a Link

<< Home