If you are like most companies, when staff leave you delete their email accounts but you likely don’t give much thought to the Distribution Lists that they used. After a few years you can have quite a few unused Distribution Lists which does not do anyone good so you should remove them.
The following command will push out an unsorted list (which you can sort in Excel) to C:\TEST.TXT of all emails sent to a distribution list after August 16, 2015. You could export all of the Distribution List
Get-MessageTrackingLog -Start 08/16/2015 -ResultSize 99999 -EventID Expand | ft Timestamp,RelatedRecipientAddress,MessageSubject -Autosize >c:\test.txt
The following command will display a count of emails sent to a single email address from August 1 2015 at to September 1 2015. That address can be a distribution list.
Get-MessageTrackingLog -start “08/01/2015 12:00:00” -End “09/01/2015 12:00:00” -Recipients “imatthews@arcis.com” -ResultSize 99999 | measure-object
For more information, you may find the following articles useful (I know I did):
http://exchangepedia.com/2009/02/are-distribution-groups-really-being-used.html
http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_27865113.html
This website uses cookies.
View Comments
Thanks for the help.. Changed it a bit and got an excel sheet..
[PS] C:\Windows\system32>Get-MessageTrackingLog -Start 02/09/2020 -ResultSize 99999 -EventID Expand | Select-Object Timestamp,Sender,RelatedRecipientAddress,MessageSubject | export-csv d:\test.csv
In case anyone runs across this article in the future, I found a slight error with the above code. If you are looking for the count of emails to a distribution list, you'll want to narrow the search down to a specfic eventid. The above code will report back with a number much higher than is correct because the Tracking Log has entries for each step in the mail flow process (e.g. TRANSFER, SEND, DELIVER). A better solution would be the follow:
Get-MessageTrackingLog -start “08/01/2015 12:00:00” -End “09/01/2015 12:00:00” -Recipients “imatthews@arcis.com” -ResultSize 99999 | Where EventId -eq 'DELIVER' | Measure-Object