Have you ever wondered what the distribution of the number of recipients per e-mail in your organization is?
The following script will go through every e-mail received by Exchange and group the results by the number of recipients.
Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -EventID RECEIVE -Start "07/05/2012" | ? {$_.Source -eq "STOREDRIVER"} | Select RecipientCount | Group RecipientCount | Select @{Name="Recipients"; Expression={[Int] $_.Name}}, Count | Sort Recipients
Alternatively, you can group them in batches depending on which format you want the output.
[Int] $1 = $2 = $5 = $10 = $30 = $50 = $75 = $100 = $150 = $200 = $250 = $300 = $350 = $400 = $500 = $600 = $700 = $800 = $900 = $1000 = $3000 = $5000 = $big = 0
Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -EventID RECEIVE -Start “07/05/2012” | ? {$_.Source -eq “STOREDRIVER”} | Select RecipientCount | ForEach {
If ($_.RecipientCount -eq 1) { $1++ }
If ($_.RecipientCount -eq 2) { $2++ }
If ($_.RecipientCount -gt 2 -and $_.RecipientCount -le 5) { $5++ }
If ($_.RecipientCount -gt 5 -and $_.RecipientCount -le 10) { $10++ }
If ($_.RecipientCount -gt 10 -and $_.RecipientCount -le 30) { $30++ }
If ($_.RecipientCount -gt 30 -and $_.RecipientCount -le 50) { $50++ }
If ($_.RecipientCount -gt 50 -and $_.RecipientCount -le 75) { $75++ }
If ($_.RecipientCount -gt 75 -and $_.RecipientCount -le 100) { $100++ }
If ($_.RecipientCount -gt 100 -and $_.RecipientCount -le 150) { $150++ }
If ($_.RecipientCount -gt 150 -and $_.RecipientCount -le 200) { $200++ }
If ($_.RecipientCount -gt 200 -and $_.RecipientCount -le 250) { $250++ }
If ($_.RecipientCount -gt 250 -and $_.RecipientCount -le 300) { $300++ }
If ($_.RecipientCount -gt 300 -and $_.RecipientCount -le 350) { $350++ }
If ($_.RecipientCount -gt 350 -and $_.RecipientCount -le 400) { $400++ }
If ($_.RecipientCount -gt 400 -and $_.RecipientCount -le 500) { $500++ }
If ($_.RecipientCount -gt 500 -and $_.RecipientCount -le 600) { $600++ }
If ($_.RecipientCount -gt 600 -and $_.RecipientCount -le 700) { $700++ }
If ($_.RecipientCount -gt 700 -and $_.RecipientCount -le 800) { $800++ }
If ($_.RecipientCount -gt 800 -and $_.RecipientCount -le 900) { $900++ }
If ($_.RecipientCount -gt 900 -and $_.RecipientCount -le 1000) { $1000++ }
If ($_.RecipientCount -gt 1000 -and $_.RecipientCount -le 3000) { $3000++ }
If ($_.RecipientCount -gt 3000 -and $_.RecipientCount -le 5000) { $5000++ }
If ($_.RecipientCount -gt 5000) { $big++ }
}
Write-Host “1, $1”
Write-Host “2, $2”
Write-Host “Between 3 and 5, $5”
Write-Host “Between 6 and 10, $10”
Write-Host “Between 11 and 30, $30”
Write-Host “Between 31 and 50, $50”
Write-Host “Between 51 and 75, $75”
Write-Host “Between 76 and 100, $100”
Write-Host “Between 101 and 150, $150”
Write-Host “Between 151 and 200, $200”
Write-Host “Between 201 and 250, $250”
Write-Host “Between 251 and 300, $300”
Write-Host “Between 301 and 350, $350”
Write-Host “Between 351 and 400, $400”
Write-Host “Between 401 and 500, $500”
Write-Host “Between 501 and 600, $600”
Write-Host “Between 601 and 700, $700”
Write-Host “Between 701 and 800, $800”
Write-Host “Between 801 and 900, $900”
Write-Host “Between 901 and 1000, $1000”
Write-Host “Between 1001 and 3000, $3000”
Write-Host “Between 3001 and 5000, $5000”
Write-Host “More than 5000, $big”