Quick Tip – Simplified Message Tracking of Senders to HTML in Exchange 2007…

I have been doing some scripting recently for the current firm that I work for; prior to my jaunt off into the sunset to take up a new position.
My tasks have primarily been focussed around defining some Exchange Management Shell scripts which will allow for simple tasks to be completed. In this article I would like to share a script with you which I have derived which gives administrators a simplified means to perform messaged tracking and format the results to a HTML file.


Download the following script to either a location on your Management Workstation or Exchange server.

ESEUtilGUIIco[1] MessageTracking.ps1

Using the Script

Open a Powershell Window and type in the following CmdLets (or if you have installed Quest PowerGUI you may wish to open and execute the scripts using):

  • Set-ExecutionPolicy RemoteSigned (confirm yes when prompted) – see below


  • Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin


From within the Powershell console navigate to the directory which contains the script file and type in the following command to execute:

PS X:\> .\MessageTracking.ps1

You will be presented with the following screen – you will be asked 3 questions:

  1. Provide the SMTP address of the Sender whom you wish to track
  2. The Start period of when you wish to track this is expected in the format of hh:mm:ss dd/mm/yyyy
  3. The end period up to where you would like to track (this forms that date and time range) and is in the format of hh:mm:ss dd/mm/yyyy


You will the be presented with a Windows Save dialog box – here you should provide the location as to where you would like the destination report – see below


You will then be notified that the script has completed – prompting you to review the report from where you saved it to – see below


Upon opening the report you will be presented with a large amount of information formatted into a HTML table – an example is presented below



The script in its current form will only perform searches based upon the sender of the message – if you would like to search on the recipient then all you need to do is change the following parameter -sender to –recipient in the following line:

Get-ExchangeServer | where {$_.ServerRole -eq "HubTransport"} | get-messageTrackingLog -Sender "$Sender" -Start "$Start" -End "$End" | Select timestamp,eventid,source,sourcecontext,messageid,messagesubject,sender,{$_.recipients},internalMessageID,clientIP,clientHostname,serverIP,serverhostname,connectorID,{$_.recipientStatus},totalbytes,recipientcount | ConvertTo-HTML -Head $formt –body " Message Tracking ReportResults" -Title "Message Tracking" | Out-File $OutputFile -Append

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.