Email an Exchange 2010 Database Report in HTML using PowerShell

Hi All,

After an upgrade to Exchange 2010, I was tasked with giving Helpdesk staff an easy way to see which database they should place new users mailboxes.. There were  several databases broken down by location and multiple databases for people in those locations. Since there was no automatic provisioning system,  the Helpdesk staff who are provisioning new users needed a way to easily see how many users are in a each database, the size of the database etc… to make this determination. Its also nice to get a snapshot view every day to make sure you don’t have an Exchange Database that’s growing out of control or to make sure your Active Databases (in a DAG scenario) are still running on the preferred server and have not failed over. For the reasons above I put together the following script that will send an email having four tables in HTML format. The four tables in the email is as include the report execution time, mailboxes per database, each database size, and the active databse server.

To run the sript below you will need the Exchange Management Shell installed on the computer your run it from. You will need to change the “From” and “To” fields with your own email addresses. You will also need to change the SMTP server to the SMTP server used in your organization.

The Script

I was unable to get the script to format properly when cutting and pasting it to this page so Im poviding as a txt file (EXDBStat.txt) at the link below.


The Output 

The output in the email will look similar to as follows:

Hope this helps. As always, I  recommend testing this and any other scripts in a lab first. If you have any questions or feedback, please leave a comment. Thanks.


Share Button
Author: BC

BC is a contributor and has been an IT Professional for 15 years. He currently works as a Sr. Systems Engineer at a private firm. He enjoys working with Active Directory, Exchange and VMware among other technologies.

Leave a Reply

Your email address will not be published.