Score:0

How to setup a daily report of users which are sending more than a defined numer of email outside organization within 24h

in flag

I'm trying to create a script and schedule it on exchange in order to have a daily report for users which are sending more than a defined numer of email outside organization within 24h.

I found this similar script but it is not the same scenario as the one i'm trying. Also i'm using Exchange 2016:

add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010

$output = Get-TransportServer | Get-MessageTrackingLog -Start (get-date).AddDays(-1) -EventID "SEND" -ResultSize Unlimited | Group-Object -Property Sender | %{ New-Object psobject -Property @{Sender=$_.Name;Recipients=($_.Group | Measure-Object RecipientCount -Sum).Sum}} | Where-Object {$_.Recipients -gt 100} | Sort-Object -Descending Recipients | Format-Table -AutoSize Sender,Recipients | Out-String

Send-MailMessage -From [email protected] -Subject "Exchange senders report: $(Get-Date -UFormat '%a, %D')" -To [email protected] -Body $output -SMTP mail.example.com
Score:0
us flag

Please use the specific email address to modify the recipient email address "[email protected]" in the following script:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
$output = Get-TransportServer | Get-MessageTrackingLog -Start (get-date).AddDays(-1) -ResultSize Unlimited | where{$ .EventId -eq "SEND" -or $.EventId -eq "SENDEXTERNAL" -and $ .Recipients -eq "[email protected]"}
$result = $output | Group-Object -Property Sender
$report = $result | %{ New-Object psobject -Property @{Sender=$.Name;Recipients=($ .Group | Measure-Object RecipientCount -Sum).Sum}} | Where-Object {$.Recipients -gt 100} | Sort-Object -Descending Recipients | Format-Table -AutoSize Sender,Recipients | Out-String
Send-MailMessage -From [email protected] -Subject "Exchange senders report: $(Get-Date -UFormat '%a, %D')" -To [email protected] -Body $report -SMTPserver smtp.contoso.com
Score:0
us flag

Please check if the script in the following similar thread is helpful to you:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
$output = Get-TransportServer | Get-MessageTrackingLog -Start (get-date).AddDays(-1) -ResultSize Unlimited | where{$ .EventId -eq "SEND" -or $.EventId -eq "SENDEXTERNAL" -and $ .Recipients -notlike "*@contoso.com*"}
$result = $output | Group-Object -Property Sender
$report = $result | %{ New-Object psobject -Property @{Sender=$.Name;Recipients=($ .Group | Measure-Object RecipientCount -Sum).Sum}} | Where-Object {$.Recipients -gt 100} | Sort-Object -Descending Recipients | Format-Table -AutoSize Sender,Recipients | Out-String
Send-MailMessage -From [email protected] -Subject "Exchange senders report: $(Get-Date -UFormat '%a, %D')" -To [email protected] -Body $report -SMTPserver smtp.contoso.com

Thread: How to setup a daily report of users which are sending more than a defined numer of email outside organization within 24h

in flag
Hello, i will try the script. Thank you so much for your reply. I have a question: this should output as a report all the users sending more then a defined numer of email toward one specific email address within last 24h ? Thank You
Ivan_Wang avatar
us flag
Do you mean the recipient of the report? If so, yes, this scripit will output entries of all external outbound emails within last 24h. If you want to specify an external recipient in the message tracking log, you can try the script in my new answer.
Ivan_Wang avatar
us flag
@Naldo Hi, it's been a while, is there update?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.