PowerShell ยป Get-MailTrafficReport

PowerShell scripts for Microsoft 365

PowerShell script to fetch Microsoft 365 mailbox traffic reports

IT admins often use PowerShell scripts to retrieve details on Microsoft 365 mailboxes, inbound/outbound mail traffic, and more. Below are some PowerShell scripts used on Microsoft 365 mailboxes.

Inbound mail traffic report
Get-MailTrafficReport -Direction Inbound -StartDate 06/13/2019 -EndDate 06/15/2019

This PowerShell cmdlet fetches the details of incoming messages between June 13, 2019 and June 15, 2019. However, it cannot fetch data older than 180 days.

Outbound mail traffic report
Get-MailTrafficReport -StartDate 6/12/2019 -EndDate 6/12/2019 -Direction Outbound | Format-Table Domain,Date,EventType,Action,MessageCount

This PowerShell cmdlet fetches the statistics on outgoing messages on June 12, 2019, and displays the results in a table. Every unique combination of EventType and Action is displayed in a separate row in the table.

Spam recipient mail traffic report
Get-MailTrafficSummaryReport -Category TopSpamRecipient -StartDate 06/13/2019 -EndDate 06/15/2019

This PowerShell cmdlet fetches the mailboxes that received the most spam between June 13, 2019 and June 15, 2019.

Mailbox size report
Get-MailboxStatistics -Identity John

This PowerShell cmdlet fetches the size of the user John's mailbox, the number of messages it contains, and the last time it was accessed.

M365 Manager Plus' pre-configured reports to the rescue

ManageEngine M365 Manager Plus, the Microsoft 365 reporting, auditing, monitoring, and management tool, is loaded with more than 700 pre-configured reports on Azure AD, Exchange Online, Skype for Business, Yammer, and other Microsoft 365 services.

M365 Manager Plus' mailbox traffic reports provide detailed insights on your organization's Microsoft 365 mailbox traffic. It offers valuable information including the volume of spam entering and leaving the organization's mailbox, the list of users who send and receive the most emails, and the users who receive the most spam and malware.

How do these reports help IT admins?

Mailbox traffic reports can help you detect any anomalies in email activity, and identify if they originated from or were delivered to a particular mailbox.

You can also export all these reports to PDF, HTML, CSV, and XLS formats, and schedule them to be generated and emailed to you at designated intervals.

Reports in this category include

  • Email traffic summary
  • Email activity
  • Top sender
  • Top receiver
  • Top spam recipients
  • Top malware recipients
  • Detailed email traffic
  • Mailbox size reports
  • Mailbox size reports

The highlights of M365 Manager Plus' reports

Advanced filters: Use attribute and condition-based filters to get the data you need without lengthy PowerShell scripts.
Reports on historical data: PowerShell cmdlets can only retrieve data that's atleast seven days old and no older than 180 days. But M365 Manager Plus reports can fetch all data right from the date of installation.
Customizable dashboard: M365 Manager Plus dashboard is customizable. Add reports in graph format to provide a quick peek at the mail traffic summary, top email senders and receivers, client device usage, and more. This dashboard can be embedded in any of your webpages to enable constant monitoring.
Report scheduler: Reports can be scheduled to be generated at regular intervals to reduce the overhead of generating reports manually.
Export report: The reports can be exported to PDF, XLS, HTML, or CSV formats and emailed to the administrator.
Secure delegation: Securely delegate the task of report generation to technicians and IT staff without giving them full access to the Microsoft 365 Admin Center.