Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

October 24, 2005 12:00 AM

Reader to Reader: Size Up Mailboxes the Easy Way

Windows IT Pro
InstantDoc ID #47973
Rating: (0)
Downloads
47973.zip

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.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.