Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


September 25, 2006

Script Lets You Easily Review Mailbox Data

RSS
Subscribe to Windows IT Pro | See More Tips Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

I have to regularly perform all kinds of analyses on the mailboxes in our Exchange Server 2003 machine. To make this task easier, I created a script named MailboxSizes.vbs, which Listing 1 shows. This script retrieves mailbox data about all the mailboxes on all the mailbox stores from an Exchange 2003 server, then outputs this information to an XML file. You can then import the XML file into Microsoft Excel or Microsoft Access for analysis.

MailboxSizes.vbs uses Windows Management Instrumentation's (WMI's) Exchange_Mailbox class to retrieve the display name, size, and total number of messages in each mailbox. The script also obtains the name of the store in which each mailbox resides.

To use MailboxSizes.vbs, you need to configure one line. In the code at callout B in Listing 1, replace Server1 with the name of your Exchange server. Then, run the command

MailboxSizes.vbs 

on that Exchange server. MailboxSizes.vbs creates the XML file in the directory in which the script is located.

If you have several Exchange servers, you can adapt MailboxSizes.vbs so that you can easily schedule the script to run as a task. With the following changes, you don't need to edit the script each time you want to use it on a different server. First, replace the code at callout A in Listing 1 with the code that Listing 2 shows. Then, in the code at callout B, replace Server1 with the variable name servername. To run the adapted script, you use the command

CScript mailboxsizes.vbs /outfile:filename.xml /server:servername

where filename is the pathname to the XML file and servername is the name of the Exchange server on which you want to run the script. (Although this command appears on several lines here, you would enter it on one line in the command-shell window.)

You can also adapt MailboxSizes.vbs so that it retrieves other types of mailbox information. For example, you can use the Exchange_Mailbox class's StorageLimitInfo property to retrieve a mailbox's storage limit settings. For information about how to use this and other properties, see the Exchange_ Mailbox Class Web page.

You can download MailboxSizes.vbs from the Exchange & Outlook Administrator Web site. This script is for use on servers running Exchange 2003, with WMI and Windows Script Host (WSH) 5.6 installed.

End of Article



Reader Comments
Hi,

Just thought I'd let you know that the link near the bottom of the article "http://msdn.microsoft.com/library/enus/e2k3/e2k3/_wmiref_cl_exchange_mailbox.asp" gives a page not found error.

Regards,
Terry

tezza October 06, 2006 (Article Rating: )


Terry, thanks for letting us know about the problem. Editors routinely check all URLs in an article, and in this case it looks like Microsoft removed the page sometime after the article was edited. I'll do some research and will try to locate an alternate URL. --Anne Grubb, senior editor

AnneG_editor October 11, 2006 (Article Rating: )


The URL error was due to a typo--it's now fixed.

AnneG_editor October 11, 2006 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Battery Life Issues Almost Certainly Not Windows 7's Fault

While Microsoft is still investigating a notebook battery life issue that was supposedly caused by Windows 7, some interesting trends have emerged. ...

Confirmed: Battery Life Issues Not Windows 7's Fault

Microsoft on Monday issued a lengthy statement about the recent Windows 7 battery controversy, echoing my assessment from earlier in the day, but backing it up with hard, cold evidence. ...

Microsoft Warns of Windows Version Expirations

Microsoft warned that this year will see three out-of-date Windows versions slip into retirement. ...


Task Automation Whitepapers Three Ways to Prevent Insider Risk within Your SCCM-Managed Environment

From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Related Events Top 5 Key Technologies Changing The Face of Exchange and Data Protection

Bail Out Your Exchange Environment

Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Patch Management

Related Task Automation Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2010 Penton Media, Inc. Terms of Use | Privacy Statement