Obtaining a quick report in MS Exchange about DLs activity

Just wanted to share a quick PowerShell one-liner which outputs a report of how many messages were sent to DLs during particular period of time.

This proved very useful on my recent project giving a good idea which DLs are most utilized and might be affected by downtime. Nice, simple, and like anything else with PowerShell, you can build on the top of this command and get lots of other “by-product” report combinations.

Get-TransportServer | Get-MessageTrackingLog -EventID “EXPAND” -Start “01/30/2016 08:00:00 PM” -End “01/30/2016 11:59:00 PM” -ResultSize unlimited | Group-Object RelatedRecipientAddress | ft name,count | Out-File C:\temp\DLs_ALL.txt

Here is also another way of viewing traffic flowing through Exchange  from the Sender point of view (useful to analyze and prepare for an old environment decommissioning):

Get-TransportServer | Get-MessageTrackingLog -EventID “SEND” -Start “10/19/2016 08:00:00 AM” -End “10/21/2016 02:10:00 AM” -ResultSize unlimited | Select Sender,{$_.Recipients}, MessageSubject,Source,MessageInfo | export-csv C:\temp\SMTP_OCT19-21.csv -NoTypeInformation