I was performing some mailbox server health checks recently and was trying to find an easy way to test mail flow latency between a lot of servers at once using Test-MailFlow.
After a little bit of tinkering I came up with a PowerShell script that would do the job, but the report it generated was a bit hard to read because all of the output was just on the screen in a single colour. So I decided to take it a step further and output the results to HTML and use colour-coded table cells to give me a report that is easier to read at a glance.

So I’m sharing the script with you here as well. Please be aware that I haven’t put a lot of coding effort into adding custom parameters, testing a wide variety of scenarios, or doing complex error handling. Also the script doesn’t troubleshoot for you, it only outputs a result that may indicate a problem for you.
Download the script file here: MailFlowHeatMap.ps1 (downloaded 1053 times so far)
How to Run the Script
The script has no parameters, you simply execute it from within PowerShell on a server or computer that has the Exchange 2010 management tools installed.
PS C:\>.\MailFlowHeatMap.ps1
You may need to right-click the downloaded file, open the Properties and unblock it. You may also need to set your PowerShell execution policy to allow unsigned scripts to run.
A small amount of output is written in the shell window to let you know that the script is making progress.

The result is a HTML file showing colour-coded table cells for the mailbox latency values (which are in seconds).

Customizing the Script
You can customize the heat map colours and the output file name by modifying these variables in the script itself (values are in seconds, cool and cold should be the same).
[int]$hot = 30 [int]$warm = 20 [int]$cool = 10 [int]$cold = 10 $filename = "mailflowheatmap.html"
If you’re looking to scheduled the script to run using Task Scheduler there is an example of how to do that here.
If you’d like to email the report to yourself there is example code here. You would just need to modify that example to use the $htmlreport in this script as the message body.
$message.Body = $htmlreport
Download the script file here: MailFlowHeatMap.ps1 (downloaded 1053 times so far)
If you have other questions please leave a comment below.




Another fine script to help us Exchange Administrators out! Great work – I’m adding it to my daily scripts.
Glad you like it Joe.
Is it right to get errors when running it on servers in a dag?
I’ve got 3 mailbox databases accross two servers (local and remote) in a DAG. Is it because the active server is LOCAL?
Seems the only one that didn’t give an error is when it tested LOCAL to LOCAL
I get …
Testing REMOTE to REMOTE
WARNING: Exchange can’t perform the mail flow test because currently there are no mailbox databases on server TRINITY.
Testing REMOTE to LOCAL
WARNING: Exchange can’t perform the mail flow test because currently there are no mailbox databases on server TRINITY.
Testing LOCAL to REMOTE
WARNING: Exchange can’t perform the mail flow test because currently there are no mailbox databases on server TRINITY.
Testing LOCAL to LOCAL
Done.
My bet is it will only report on the databases that are active on the server you’re running the script against.
We’ve got a 2 location, 4 DB DAG, with 2 running in one location, and the other 2 in the other.
The script should report the 2 that are running on the server they’re currently mounted on.
Yes, the script will error (or really its just a warning) for a DAG member with no active databases.
Question / Suggestion:
Could this HTML output include a reference legend for the code …..
td.cold{background: #B3E6B3;}
td.cool{background: #E2F09C;}
td.warm{background: #FF6E6E;}
td.hot{background: #E34949; color: #ffffff;}
A visual so it is known what the values and color relationships are?
Thanks for the great script Paul.
I got a bit worried when I ran it the first time, as it errored everywhere, but then.. yeah.. realised that only one of our DAG servers is active..
BB-EX02 Error Error Error
RC-EX02 Error Error Error
RC-EX03 Error Error 2.77
I will definitely file this one away for future reference though, thanks again!
I meant to say also, for a larger organisation with multiple active servers, scheduling this with another task to copy it to a IIS server where the html file could be viewed in IE by the whole IT team, that would be fantastic.
I would like this to email through the results the same way the test-exchangeserverhealth script does.
please can you help elobrate on the format to get it the same
Hi Paul,
Can you tell me how to verify daily /weekly/monthly email transactions from Exchange servers 2010.
I there any reporting tool ?
Thanks and Regards,
Amit Atugade
Hi Paul,
Can you tell me how to verify daily /weekly/monthly email transactions from Exchange servers 2010.
I there any reporting tool ?
Hi Paul,
Thanks very much for sharing this. The script is very handy. It worked like charm almost since first run despite a permission error trying to create the html in C:\ (My bad)
Thanks again mate.
Hi Man,
Thanks for your script, this is perfect.
I have one question.
When I execute this script in a physical machine, evertything is all right on report but when i execute this one in one virtual machine the report be all red…
Do you know why this things happen? did you see it in another environment?
Regards.
I can’t think of any reason a physical vs virtual would give you different results other than that the virtual machine is under-resourced perhaps.