Parsing Message Headers using Powershell

So sometimes I want or need to look at the message headers of an email to work out where it comes from. You can use something like http://mxtoolbox.com/public/tools/emailheaders.aspx to do that, but I thought, you must be able to so this with Windows Powershell. Guess what you can ;-)

Meet Parse-EmailHeaders.ps1. Now I cheated a little by using Sapien Powershell Studio to build the GUI as I couldn’t be bothered to manually create the GUI in notepad ;-)

So fireup powershell and run the script.

Essentially, in outlook get the message header of an email and paste it in to the GUI box and click on the Parse Button.

Why have this? Well I put all my known Exchange Hub and Edge servers in, with the Datacentre location so I can see the path it took. Create the csv file in the same folder as the .ps1 and chop and change as you wish.