Skip to content

Instantly share code, notes, and snippets.

@at0dd
Created November 24, 2016 02:55
Show Gist options
  • Save at0dd/a699c963dc900d3d21e4a1238fe01850 to your computer and use it in GitHub Desktop.
Save at0dd/a699c963dc900d3d21e4a1238fe01850 to your computer and use it in GitHub Desktop.
Searches for emails and gets email tracking logs
#Searches a target mailbox for emails from a specific address and places the results in a specified mailbox, under a specified folder name.
Search-Mailbox "John Doe" -SearchQuery "from:'Jane.Doe@contoso.com'" -TargetMailbox "Your Mailbox" -TargetFolder "Folder Name" -LogLevel Full
#Retrieves a log of emails from a specified date from a specified email address to a specified email address and places the results in a CSV file on your desktop.
Get-MessageTrackingLog -ResultSize Unlimited -Start "01/01/2000 12:00AM" -End "12/31/2000 11:59PM" -Sender "Jane.Doe@contoso.com" -Recipients "John.Doe@contoso.com" | Export-CSV "$env:userprofile\Desktop\Emails.csv" -NoTypeInformation -Encoding UTF8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment