Forum Discussion
622261760
Feb 19, 2025Copper Contributor
Collect count of emails sent to ALL Distribution Groups in ExOL
Hey Team, I am looking for PowerShell assistance, such as exporting a list of all distribution groups and measuring how many messages were sent to each DG in the past 10 days.
Basically, how can I combine
"Get-DistributionGroup -ResultSize Unlimited | Select-Object Name, DisplayName,GroupType,PrimarySmtpAddress | Export-csv c:\temp\DistributionGroupReport.csv -NoTypeInformation"
and
"Get-MessageTrace -StartDate (get-date).AddDays(-10) -EndDate (Get-Date) -RecipientAddress email address removed for privacy reasons | measure-object | Select Count"
to a single csv, if possible. Thanks.
Tony has a ready to use script for this scenario: https://office365itpros.com/2018/11/15/find-inactive-distribution-lists/