You want to find all messages and delivery details from a specific sender address.
$sender = "tony@starkenterprises.com" # replace with your sender address
$lookbackdays = 4 # adjust the look back period as needed
Get-MessageTrace -StartDate (Get-Date).AddDays(-1*$lookbackdays) -EndDate (Get-Date) -SenderAddress $sender |
ForEach-Object -Process {$_ | Out-Default
Get-MessageTraceDetail -RecipientAddress ($_.RecipientAddress) -MessageTraceId ($_.MessageTraceID)}
Piping the results of Get-MessageTrace
to Get-MessageTraceDetails
provides detail on where the message was delivered.
If you don’t specify start or end dates, only data from the last 48 hours is returned1.
The Get-MessageTrace
command can only look back 10 days.
If you need data on messages older than 10 days, use this recipe.
Description section of Get-MessageTrace
help documentation. ↩