I have received several requests for a report to list the number of sent and received messages for each user in a specified domain. Get-MessageSumary.ps1 is the script that I created for this purpose and it can be downloaded from my GitHub repository.
The current version of the script searches all the transport servers in the environment to get a message count for all sent and received messages per user in a specific domain and writes the data to an HTML report.
You must run the script from the Exchange Management Shell. The only required parameter is the domain that you wish to search. However, you can provide specific start and end dates for the search and also a desired location for the report file using the parameters below.
[PS] C:\Scripts> .\Get-MessageSummary.ps1 -Domain "domain"
[PS] C:\Scripts> .\Get-MessageSummary.ps1 -Domain "domain" -HTMLReport "C:\Temp\report.html" -StartDate "1/1/2017" -EndDate "1/4/2017"
As the script runs, it provide status updates for each user.
After the script completes, it will tell you where the HTML report was saved to.
The HTML report is nothing fancy.
My PowerShell scripting ‘foo’ isn’t the greatest, and I by no means claim to be a scripting expert. There may be better ways to accomplish the things I’ve done but the script does accomplish the required task pretty nicely.