How to track emails with Office 365 message trace using Powershell

How to track emails with Office 365 message trace using Powershell, in this article we check how to track emails with Office 365 message trace using Powershell.

Tracking emails is an essential task for organizations to ensure efficient communication and resolve any delivery issues. Office 365 Message Trace is a powerful tool that allows administrators to monitor email messages within their organization. In this article, we will explore how to effectively track emails using PowerShell with Office 365 Message Trace.

How to track emails with Office 365 message trace using Powershell


To track emails using Office 365 Message Trace with PowerShell, you need to meet the following prerequisites:

  1. An active Office 365 subscription with Exchange Online.
  2. PowerShell version 5.1 or later installed on your computer.
  3. The Exchange Online Remote PowerShell Module must be installed.

How to track emails with Office 365 message trace using Powershell?

Step 1: Connect to Exchange Online

Begin by launching PowerShell with administrative privileges and establishing a connection to Exchange Online using the following commands:


Step 2: Run Message Trace

With the connection to Exchange Online established, execute the Message Trace command to track emails. Use the following PowerShell cmdlet:

Get-MessageTrace -StartDate "MM/DD/YYYY" -EndDate "MM/DD/YYYY"

Replace “MM/DD/YYYY” with the desired date range for the message trace. This command will retrieve all email messages sent or received within the specified date range.

Step 3: Filter Message Trace Results (Optional)

To narrow down the results based on specific criteria, you can utilize additional parameters with the Get-MessageTrace cmdlet. Here are some commonly used filters:

  • SenderAddress: Filters emails sent from a specific sender.
  • RecipientAddress: Filters emails sent to a specific recipient.
  • Status: Filters emails based on their delivery status (e.g., Delivered, Failed, Pending).
  • MessageSubject: Filters emails based on the subject line.

For instance, to filter the message trace results by sender address, use the following command:

Get-MessageTrace -StartDate "MM/DD/YYYY" -EndDate "MM/DD/YYYY" -SenderAddress ""

Step 4: Analyze Message Trace Results

Upon executing the Message Trace command, you will receive a list of email messages that match your specified criteria. The results will provide information such as the sender, recipient, subject, delivery status, and timestamp. This data can be utilized to investigate email delivery issues and analyze email patterns within your organization.

Step 5: Export Message Trace Results (Optional)

If you wish to save the message trace results for further analysis or reporting, you can export them to a CSV file. Utilize the following PowerShell command to export the results:

Get-MessageTrace -StartDate "MM/DD/YYYY" -EndDate "MM/DD/YYYY" | Export-Csv -Path "C:\Path\to\ExportedResults.csv" -NoTypeInformation

Replace “C:\Path\to\ExportedResults.csv” with the desired file path and name.


Tracking emails using Office 365 Message Trace is a valuable tool for administrators to ensure effective communication within their organization. By employing PowerShell, you can easily retrieve and analyze email message data, aiding in troubleshooting delivery issues and gaining insights into email patterns. Follow the step-by-step guide outlined in this article to leverage the power of Office 365 Message Trace and streamline your email management process.

Visit to check more article

Leave a Reply

Your email address will not be published. Required fields are marked *

eighteen − five =