Forum Discussion

622261760's avatar
622261760
Copper Contributor
Feb 19, 2025

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. 

Resources