Subscribe to Windows IT Pro

 

Get Newsletters

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

Subscribe Now!

September 25, 2006 12:00 AM

Script Lets You Easily Review Mailbox Data

Windows IT Pro
InstantDoc ID #93350
Rating: (3)
Downloads
93350.zip

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.

Related Content:

ARTICLE TOOLS

Comments
  • Anne
    6 years ago
    Oct 11, 2006

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

  • Anne
    6 years ago
    Oct 11, 2006

    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

  • Terry
    6 years ago
    Oct 06, 2006

    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

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.