Find emails log from a particular sender in the last hour:
Get-MessageTrackingLog -Sender "" -Start (Get-Date).addhourse(-1)
Find emails log and filter based on sender domain:
Get-messagetrackinglog | where {[string]$_.recipients -like "*@domain.com"}
Find all emails log from a particular sender between a certain time period:
Get-messagetrackinglog -sender [email protected] -Start "02/24/2019 09:00:00" -End "02/25/2019 17:00:00" |ft Timestamp, Source, Sender, Recipients MessageSubject
Find all emails log in specific time period and mails sent to any user under “msnoob.com” domain:
Get-MessageTrackingLog -ResultSize Unlimited -Start "02/24/2019" -End "02/25/2019" | where {$_.recipients –like "*@domain.com"} | select-object Timestamp,SourceContext,Source,EventId,MessageSubject,Sender,{$_.Recipients}
The Get-MessageTrackingLog
results are displayed on-screen.
You can write the results to a file by piping the output to ConvertTo-Html
or ConvertTo-Csv
and adding >
to the command.
Export to CSV.
Get-MessageTrackingLog -Sender [email protected] -Start (Get-Date).AddHours(-1) | export-csv C:tempMessageTrackingLogResults.csv