Skip navigation

Reader to Reader: Size Up Mailboxes the Easy Way

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.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish