Number of recipients sent to by user per day report
-
Monday, December 12, 2011 8:38 PM
I'm looking for a way to see a report by user of how many recipients they send to in a day. This is in preperation of moving to Office365 and thus far I have not found a 'good' way to do this. I have messed with it for a while now and have the following script running in my environment daily:
Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin
$filename = "MessagesSent {0:MM-dd}" -f (Get-Date).AddDays(-1)
$start = (Get-Date).AddDays(-1)
$end = (Get-Date)Get-transportserver | Get-MessageTrackingLog -resultsize unlimited -Start $start -End $end | where-object {$_.EventID -eq "SEND" -or $_.EventID -eq "DELIVER" -or $_.EventID -eq "Expand"} | where-object {$_.Sender -like *@domain.com} | select TimeStamp, Sender, RecipientCount | Group-Object Sender | select Count, Name | Sort-Object Count -descending | Format-Table -AutoSize | Out-File D:\ExchangeMessagesDelivered\$filename.txt
Get-transportserver | get-messagetrackinglog -resultsize unlimited -Start $start -End $end | where-object {$_.EventID -eq "SEND" -or $_.EventID -eq "DELIVER" -or $_.EventID -eq "Expand" -or $_.EventID -eq "Transfer" -or $_.EventID -eq "Receive"} | where-object {$_.Sender -like "*@domain.com"} | select TimeStamp, EventID, Sender, RecipientCount | Format-Table -AutoSize | Out-File D:\ExchangeMessagesDelivered\Verbose_$filename.txt -width 200
The first get-transportserver | get-messagetrackinglog does not give me accurate results so I was trying to add more eventID's in. This gives me more information but now I'm getting messages counted more than once..
Anyone have any ideas?
Jason Meyer- Edited by JMeyer2009 Wednesday, December 14, 2011 3:34 PM
All Replies
-
Tuesday, December 13, 2011 8:21 AM
-
Tuesday, December 13, 2011 8:26 AM
Besides, you can try to use Log Praser to analyze the message tracking log.
Process Tracking Log tool for Exchange Server 2007
http://blogs.technet.com/b/exchange/archive/2008/02/07/3404839.aspx
Message Tracking tips in Exchange 2007 / Exchange 2010 using CMD lets
Xiu Zhang
TechNet Community Support
-
Wednesday, December 21, 2011 6:50 AM
-
Wednesday, December 21, 2011 3:40 PM
I haven't had the time to setup the Log Parser and currently using powershell scripts isn't getting accurate information. I'm getting numbers from distribution groups multiple times so the sum of total recipients is off by a multiple of roughly 2 times..
What we do have is a good picture of the senders that are sending to thousands of recipients versus hundreds, so the priority of getting 100% accurate numbers has fallen.
Thanks for the input, if there are any more thoughts on getting a powershell command to get accurate results I'd like to see them.
Jason Meyer -
Friday, December 23, 2011 8:48 AM
-
Thursday, December 29, 2011 9:28 PM
So the command I tried was:
[PS] D:\>Get-transportserver | Get-MessageTrackingLog -resultsize unlimited -Start "12/29/2011 8:00:00 AM" | where-object {$_.Sender -like me@myemail.com} | select Send
er, RecipientCount, MessageSubject | Sort-Object -Unique MessageSubject | ft -AutoSizeUnfortunately it appears to only return the recipient count from the last e-mail with the same subject.
So, if a user sends out a bulk e-mail with the subject "Important Information" to list A that has 1,200 recipients and then sends out the same e-mail with subject "Important Information to list B that has 6 recipients, this command will only show the 6 recipients.
Thank you Xiu for the input though, I was not familiar with the "-unique" tag for sort-object.
Jason Meyer -
Thursday, January 05, 2012 2:19 AM
-
Sunday, January 08, 2012 3:02 PMCan you just please clarify something for me? You want how many recipients a user sent e-mails to in a day, right? But do you want unique recipients? Is enough to sum the RecipientCount per each e-mail they send?
http://LetsExchange.blogspot.com -
Sunday, January 08, 2012 3:11 PM
If you don't care about unique recipients and I only send two e-mails today to the same recipient, this will output 2:
ForEach ($email in (Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start "01/08/2012" -Sender user@domain.com -EventId RECEIVE | ? {$_.Source -eq "STOREDRIVER"} | Select RecipientCount)) {$total += $email.RecipientCount} $total
If you just want unique recipients, this will output 1:
[String] $total = $null ForEach ($email in (Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start "01/08/2012" -Sender user@domain.com -EventId RECEIVE | ? {$_.Source -eq "STOREDRIVER"} | Select Recipients)) {$total += "$($email.Recipients) "} $total2 = $total.Split(" ") ($total2 | sort -Unique).Count - 1
http://LetsExchange.blogspot.com -
Sunday, January 15, 2012 6:14 PMAny update?
http://LetsExchange.blogspot.com -
Thursday, April 12, 2012 11:07 PM
Ever considered just using the Exchange Profile Analyzer? It will do everything you're requesting (and more), and it's free. It takes a little bit to setup, but definitely worth it (especially if you're planning to move to O365).
Exchange Profile Analyzer
http://technet.microsoft.com/en-us/library/bb508856(v=EXCHG.65).aspx
Good luck. I hope this helps!
Travis J. Moore Exchange | Senior Engineer Planet Technologies | www.Go-Planet.com
- Proposed As Answer by Travis Moore Thursday, April 12, 2012 11:07 PM

