You can use script below to expand {pam@constoso.com,bill@Company portal .com,jill@Company portal .com}:
$temps = Get-TransportService | Get-MessageTrackingLog -Sender User@domain.com -MessageSubject "test7/5" -EventId DELIVER
Foreach ($temp in $temps) {
$i = 0
while ($temp.Recipients[$i] -ne $null) {
Write-host $temp.EventID $temp.Sender $temp.MessageSubject $temp.Recipients[$i] $temp.Timestamp
$i++
}
}
By the way, Exchange Q&A forum doesn't support writing script according to needs so far. If you have more requirements about scripts, I suggest you open a ticket to Microsoft to get a more professional script.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
II can see that the steps will output the results to the screen. What I'm after is having the results in a hash table, as I want to reference the results further down in the script? So if the original results were in $temps, then I'd like to get the results in $temps2 for example.
You can use “>>c:/temp/result.txt” to export result to a file. If you want another specific format, you may need to open a ticket to Microsoft for getting a more professional script.