CDOLive LLC The Premier Resource for Microsoft Collaboration Data Objects             

Scheduled Mailbox Report Script

This sample creates a report on all mailboxes on a particular Microsoft Exchange server and sends it attached to an e-mail message to a particular administrator mailbox. The report includes information about the display name, size of the mailbox, count of all messages at the mailbox, count of unread messages at the inbox of each mailbox and the e-mail address. The attachment is created in the comma separated value (csv) format and can be imported into Microsoft Excel.

This is especially useful if you want to send a report to a person other than the Microsoft Exchange administrator to account for the used mailbox space on your Microsoft Exchange Server.

Known Issues

This sample does not check if there is enough disk space and the NT account has sufficient permissions to create and write files. Also it cannot read the last logon and last logoff time of a particular mailbox because these properties cannot be accessed with CDO.

Don't hide the mailbox or the public folder from the Global Address List (GAL), because the Microsoft Exchange Server Scripting and Routing script will fail to run if the mailbox or the public folder is not visible in the GAL.

Microsoft Exchange Server Scripting and Routing scripts are not running synchronously. It can take up to 60 seconds before the script is fired.

Also keep in mind that it can take a lot of time and system resources to run this script. Please take a look at the Microsoft Knowledge Base article 'Suitable Applications for Microsoft Exchange Server Event Scripting' about the limitations of Microsoft Exchange Server Scripting and Routing before you use the sample. It can be found at 'The Secrets of Exchange Server Scripting & Routing', Useful Links.

Prerequisites

Make sure that Microsoft Exchange Server 5.5 with the Microsoft Event Service is installed and running properly. For more information about the Microsoft Exchange Server Scripting and Routing please take a look at The Secrets of Exchange Server Scripting and Routing.

This sample needs to run under a NT account which has the permission to open all mailboxes on the particular Microsoft Exchange Server (e. g. the Exchange Service account), because it will open each mailbox to read the report info.

Checked Build

If you would like to use this sample with another language version of Microsoft Exchange Server or Microsoft Outlook, it is possible that the sample will not work without modifications. Please consult the source code for more information. This sample is built and checked for a proper function using the following environment:

  • Microsoft Windows NT Server 4.0, with Service Pack 4, US English - International
  • Microsoft Exchange Server 5.5, with Service Pack 1, US English - International
  • Microsoft Outlook 98, with Security Patch 2 (aka. outptch2), US English - International
Installation and Configuration
Component Description
'Mailbox Report' Mailbox The mailbox, which is used to create and send the report.

To create the mailbox start the Microsoft Exchange admin program and add a new recipient called 'Mailbox Report'. Associate the Microsoft Exchange Server Service account to this mailbox, to make sure that the Microsoft Exchange Server Scripting and Routing script can run without problems. In the 'Permissions' tab of the mailbox add the NT account of yourself to make sure that you can open the mailbox and install the Microsoft Exchange Server Scripting and Routing script later.

Use the Microsoft Exchange admin program to add the 'Mailbox Report' mailbox to the 'Folders\System Folders\Events Root\EventConfig_<Your Servername>' folder with 'Owner' permissions to make sure that this mailbox can create and modify Microsoft Exchange Server Scripting and Routing scripts. If you don't see this particular folder in the Microsoft Exchange admin program it is possible that the Microsoft Exchange Event Service is not installed or you are not running Microsoft Exchange Server 5.5. For more information please take a look at 'The Secrets of Exchange Server Scripting and Routing', Installation.

Create a new MAPI profile on your machine for the Exchange Server Service called 'Mailbox Report' and add the mailbox 'Mailbox Report' to the profile.

mbxreport.zip (4 Kbyte) Scripting and Routing Script The Microsoft Exchange Server Scripting and Routing script.

To install the script, start the Microsoft Outlook client and logon as the mailbox 'Mailbox Report'. Select the Inbox folder and right click on it to choose the properties. If you are not able to see the 'Agents' tab you may not have installed Microsoft Outlook 97 8.03 (or later), the Server Scripting add-on is not installed in Microsoft Outlook 97/98 or the permissions are not set properly. For more information please take a look at 'The Secrets of Exchange Server Scripting and Routing', Permissions and Security.

Open the Microsoft Exchange Scripting and Routing script with notepad and choose 'Edit', 'Select All' and copy it to the clipboard. Open the properties of the inbox of the mailbox 'Mailbox Report' and select the 'Agents' tab. Choose 'New...',  enter the agent name 'Mailbox Report' and choose 'A scheduled event occurs' from the 'When the following event(s) occur:' list. Choose 'Schedule' and select the time schedule you want to receive the report. Choose 'Edit Script...' and choose 'Edit', 'Select All' in the editor, which is opened. Paste your Microsoft Exchange Scripting and Routing script in the editor and choose 'File', 'Exit'. You now will be asked to save the changes in a particular file. Don't bother about the filename select 'Yes' and exit all dialog boxes by choosing 'OK'.

To allow the Microsoft Exchange Event Service to update this information wait about 5 minutes and then you can try to start testing your solution.