Why do I get “System.String[]” when using Get-MessageTrackingLog and exporting to a CSV?


Let’s say a user is having problems sending e-mails. You decide to have a look at the Transport Logs to see if there are any clues of what might be happening. So you run the following cmdlet:

 

Get-TransportServer | Get-MessageTrackingLog -ResultSize -Start "11/28/2011" -Sender [email protected] | Select * | Export-Csv D:\Reports\Sent_Nuno.csv -NoType

 

However, you notice that the Recipients and RecipientStatus fields have "System.String[]" instead of the actual recipients or recipient information!

The problem here is that these fields are a collection of objects and, as subject, you have to expand them into a string so they show properly when you pass them to the Export-CSV cmdlet. The easiest way to achieve this is to put them in between {}. Here’s a simple example:

 

Get-TransportServer | Get-MessageTrackingLog -ResultSize -Start "11/28/2011" -Sender [email protected] | Select {$_.Recipients}, {$_.RecipientStatus}, * | Export-Csv D:\Reports\Sent_Nuno.csv -NoType

1 thought on “Why do I get “System.String[]” when using Get-MessageTrackingLog and exporting to a CSV?”

Leave a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top