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


October 24, 2005

Reader to Reader: Size Up Mailboxes the Easy Way

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

Download the Code Here

Manually obtaining the size of every mailbox on a given Exchange Server 2003 system is tedious. You have to launch Exchange System Manager (ESM), drill down to the mailbox-store level, and export the mailbox list for every mailbox store. If you have more than one mailbox store on your Exchange 2003 server, you have to combine the mailbox lists in Microsoft Excel to get a complete list of mailboxes and their sizes. If you must do all this work just for one Exchange 2003 server in your administrative group, imagine how tedious this manual process would be if you have multiple Exchange servers.

A much easier solution is to use a VBScript script to automatically gather the data and place it in a Microsoft Access table. You can then use Access to run queries and print reports. I created such a script, called Populate.vbs. This script takes advantage of the Windows Management Instrumentation (WMI) class named Exchange_Mailbox. This class's Size property specifies the cumulative size of all the messages in a mailbox. (For more information about the Exchange_Mailbox class, go to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_wmiref_cl_exchange_mailbox.asp.)

You can download Populate.vbs from the Exchange & Outlook Administrator Web site. Go to http://www.windowsitpro.com/microsoftexchangeoutlook, enter 47973 in the InstantDoc ID text box, then click the 47973.zip hotlink. The script assumes the following:

  • You have one Exchange 2003 server.
  • You'll be running the script from a Windows XP, Windows 2000 Server, or Win2K Professional machine.
  • The Access database resides on the XP or Win2K machine.

Populate.vbs is easy to use. You have to make only one minor customization, which I'll explain shortly. This script must be run under Exchange Administrator credentials.

To use Populate.vbs, follow these steps:

  1. Create a new Access database, named exchange.mdb. In this database, create a new table that has the column fields that Table 1 shows. Save this table, giving it the name size. The database and table are now ready for data.
  2. On the workstation that contains the Access database, create an ODBC System Data Source Name (DSN) file named Exchange. A System DSN file contains information about a particular database, such as the type of database (e.g., Microsoft SQL Server database, Access database) and the database's physical location on the computer.
  3. In XP, open the Control Panel Administrative Tools applet and select Data Sources (ODBC). Click the System DSN tab, then the Add button. Choose Microsoft Access Driver (*.mdb), and click Finish. In the Data Source Name text box, type Exchange. In the Database section, click Select. Find the exchange.mdb database you created earlier, select it, and click OK. Click OK to exit the ODBC Data Source Administrator window. In Win2K, this step is done in a similar way.
  4. Open Populate.vbs in Notepad. Find the line of code that Listing 1 shows. Replace Your Exchange 2003 Server Name Goes Here with the name of your Exchange 2003 server. Your server's name must be enclosed in quotes. Save the script with your modification.
  5. Open a command-shell window. Change to the directory in which the script resides, then run the command
    cscript.exe populate.vbs

Alternatively, you can use Task Scheduler to schedule the script to run periodically.

Populate.vbs connects to your Exchange 2003 server, connects to the Access table you created, and populates that table with each mailbox's display name and size. After the data is in the database, the possibilities of what you can do with this data are endless. For example, you can create an Active Server Pages (ASP) Web page to query the database and present the data in a Web browser. Or you can perform trend analyses and obtain statistics such as the changes in mailbox sizes over a week or month. As you can see, this script can come in handy.

End of Article



Reader Comments

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
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Understanding File-Size Limits on NTFS and FAT

A general confusion about files sizes on FAT seems to stem from FAT32's file-size limit of 4GB and partition-size limit of 2TB. ...


Task Automation Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Will Your Next Generation Server System Meet Your Infrastructure Optimization Needs?

Continuous Data Protection and Recovery for Microsoft Exchange

Related Events WinConnections and Microsoft® Exchange Connections

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.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement