Exchange 2010: How to export Message Tracking results to Excel Sheet?


It turn out to be exporting message tracking results to a CSV file is not THAT easy. To get the message tracking log, Exchange shell has Get-MesssageTrackingLog cmdlet. Say we run the following command and export the results to CSV.

get-messagetrackinglog -Sender “SuperMan@DailyMail.com” -Server “DMMail2Server” -Start “6/13/2012 12:45:00 PM” -End “6/13/2012 1:35:00 PM” | Export-CSV .\MailTrackingLogs.csv

The results comes with few “System.String[]” instead of real data. e.g., Recipients, Subject.

I struggle a bit. Then I found this MS Exchange Developers Team blog.  Sadly the command wasn’t in text, it was screenshot of the Exchange Shell.

The trick is to pipe the Get-MessageTrackingLog results to Select command. Type selected objects as string object in a code block  like {$_.Recipients}. That did the trick. Here is the same full command.

Get-MessageTrackingLog -Sender “SuperMan@DailyMail.com” -Server “DMMail2Server” -Start “6/13/2012 12:45:00 PM” -End “6/13/2012 1:35:00 PM” | Select Sender,{$_.Recipients},{$_.RecipientStatus},MessageSubject,TimeStamp, EventId, Source, SourceContext,MessageId,InternalMessageId,ClientIP,ClientHostName,ServerIP,ServerHostName,ConnectorId,TotalBytes,RecipientCount,RelatedRecipientAddress,Reference,ReturnPath,MessageInfo | Export-Csv .\MessageTrackingLog.csv

7 thoughts on “Exchange 2010: How to export Message Tracking results to Excel Sheet?

Leave a comment