separate listing of emails with multiple recipients?

by Heine at 2013-02-27 02:20:19


Does anyone know how I can get a list from the messagetrackinglog where an email send to multiple recipients is listed on separate lines with on recipient on each?

I’m working with the following objects: |Select-object Timestamp, Sender, Recipients, MessageSubject |
by poshoholic at 2013-02-27 07:20:53
So you are reading the contents of the tracking log, and the Recipients property has a newline-delimited list of email addresses? If that’s an accurate assessment, you could replace your Recipients property name above with this:
@{Name='Recipients';Expression={@($.Recipients -split "rn|r|n")}}
That tells PowerShell to make the Recipients property of the selected object contain an array of the Recipients property you passed in, split on any newline character combination.
by Heine at 2013-05-03 03:21:21
Hi Kirk

Thanks for the reply.

I’m totally new to Powershell so unfortunately I don’t think I understand your question.

But let me try to elaborate a bit on my problem.

I’m working with the below script and it returns the following to me:

#TYPE Selected.Microsoft.Exchange.Management.TransportLogSearchTasks.MessageTrackingEvent
"26-02-2013 09:09:49","SMTP","2","",""

What I would like it to return is:

#TYPE Selected.Microsoft.Exchange.Management.TransportLogSearchTasks.MessageTrackingEvent
"26-02-2013 09:09:49","SMTP","2","",""
"26-02-2013 09:09:49","SMTP","2","",""

How should I do that ?

$EmailDomainOne = ""
$EmailDomainTwo = ""
$startdate = "2/26/2013 9:00am"
$enddate = "2/26/2013 11:00am"
$outputfile = "test1.txt"

get-messagetrackinglog -start $startdate -end $enddate -resultsize unlimited| where {(([string]$
.recipients -like $EmailDomainOne -and [string]$
.sender -like $EmailDomainTwo)) -and (($
.eventid -eq "SEND") )} | Select-object Timestamp, Source, RecipientCount,Sender, {$_.recipients} | Sort-Object -Property Timestamp| export-csv $outputfile -Encoding unicode