Search Exchange Message Tracking Logs with a wildcard
When using the Get-MessageTrackingLog cmdlet you can’t use wildcards with the Sender or Recipient parameters. Instead, I pipe the output of Get-MessageTrackingLog to Where-Object:
Where-Object {$_.Recipients -Like *@gmail.com}
The following PowerShell command will return all results from a server named "Exchange01" that were sent to anybody with a @gmail.com address on a specific date:
Get-MessageTrackingLog -Server "Exchange01" -Start "01/01/2015 10:00" -End "01/01/2015 12:00" -ResultSize "Unlimited" | Where-Object {$_.Recipients -Like *@gmail.com} | FT -Wrap -Property Timestamp,Sender,Recipients,MessageSubject,TotalBytes
As you can see, I have also piped the output to the FT (Format-Table) command, specifying which properties I want to see, to make the output more readable.