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 16:40" | ? {$_.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 = $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) { $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 "More than 300, $big"
No comments:
Post a Comment