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
Yes! Thank you! The recipients field was giving me System.String[] in the CSV.