Steps to Trace Exchange Email Messages in PowerShell
1. To begin, you’ll need to open PowerShell as an administrator. You can do this by searching for PowerShell in the start menu, and then right-clicking on it and selecting “Run as Administrator”.
2. Once PowerShell is open, you’ll need to connect to your Exchange Online. You can do this by running the following command:
> Connect-ExchangeOnline
3. Get message trace logs of a mailbox
> Get-MessageTrace -RecipientAddress <mailbox> -start “Date” -end “Date”
> Get-MessageTrace -RecipientAddress <mailbox> -start “Date” -end “Date” > c:\temp\email.log
Replace “Date” with the date that you want to start tracing from, and end date with the date that you want to stop tracing. The tracking information will be saved in the c:\temp\tracking.log file, which you can then open up in a text editor to view the results.
4. View detailed information of traces
> Get-MessageTrace -RecipientAddress <mailbox> -start “Date” -end “Date” | FL
> Get-MessageTraceDetail -MessageTraceId <ID> -RecipientAddress <mailbox>