Hello Rita Rita,
Welcome to Microsoft Q&A forum.
Regarding your inquiry, to get the external mail send count for the "IT" group in Microsoft 365, use Exchange Online PowerShell to query message trace data, as there’s no direct report in the Admin Center for group-level external emails. Below is the PowerShell script for the solution:
# Connect to Exchange Online PowerShell
Install-Module -Name ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName <******@yourdomain.com>
# Get "IT" Group Members and Count External Emails: Run this script to count emails sent by "IT" group members to external recipients (outside your domain) in the last 30 days:
$GroupName = "IT"
$Domain = "yourdomain.com"
$StartDate = (Get-Date).AddDays(-30)
$EndDate = Get-Date
$GroupMembers = Get-DistributionGroupMember -Identity $GroupName | Select-Object -ExpandProperty PrimarySmtpAddress
$ExternalMailCount = 0
foreach ($Member in $GroupMembers) {
$ExternalMails = Get-MessageTrace -SenderAddress $Member -StartDate $StartDate -EndDate $EndDate | Where-Object { $_.RecipientAddress -notlike "*@$Domain" }
$ExternalMailCount += $ExternalMails.Count
}
# Replace yourdomain.com with your organization’s domain. Adjust $StartDate if needed.
# Export to CSV (Optional):
$Results = @()
foreach ($Member in $GroupMembers) {
$ExternalMails = Get-MessageTrace -SenderAddress $Member -StartDate $StartDate -EndDate $EndDate | Where-Object { $_.RecipientAddress -notlike "*@$Domain" }
$Results += [PSCustomObject]@{
Sender = $Member
ExternalMailCount = $ExternalMails.Count
}
}
$Results | Export-Csv -Path "C:\Your own csv path" -NoTypeInformation
Notes:
- Requires Global Admin or Exchange Admin permissions.
- Message trace data is limited to 30 days.
- For large groups, the script may take time to run.
In case you run into any Error or require further assistance, please feel free to comment below. I here to help!
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.