This script connects to Office 365 and retrieves the inbound and outbound mail traffic statistics by recipient for all available dates. This information is then exported to a CSV file which can be opened in Microsoft Excel.
This script connects to Office 365 and retrieves the inbound and outbound mail traffic statistics by recipient for all available dates. Microsoft do not consistenty store message tracking information and you may only see results for the last few days.
It collects this information using the Get-MessageTrace cmdlet, which parses the SMTP Message Tracking logs within Office 365. This information is then combined within the script to create a meaningful output.
More information about this script and how it works can be found on the Cogmotive Office 365 reporting blog.
To use the script:
Open PowerShell and run the script as shown below. Obviously you need to replace the username and password with your own values.
.Get-DetailedMessageStats.ps1 -Office365Username a[email protected] -Office365Password Password123
Below you can see an example of the output, which is saved in CSV format. This output file can be opened in Microsoft Excel and manipulated for your own needs.