E-mail Size Distribution

Have you ever wondered what the size distribution of e-mails in your organization is?

The following script will go through every e-mail received by Exchange and group the results according to the distribution size you want:

[Int64] $5KB, $10KB, $25KB, $50KB, $100KB, $256KB, $512KB = $1MB = $2MB = $5MB = $10MB = $15MB = $20MB = $30MB = $big = 0

Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start “07/03/2012” -EventID RECEIVE | ? {$_.Source -eq “STOREDRIVER”} | Select TotalBytes | ForEach {

    If ($_.TotalBytes -lt 5KB) { $5KB++ }

    If ($_.TotalBytes -ge 5KB   -and $_.TotalBytes -lt 10KB)  { $10KB++ }

    If ($_.TotalBytes -ge 10KB  -and $_.TotalBytes -lt 25KB)  { $25KB++ }

    If ($_.TotalBytes -ge 25KB  -and $_.TotalBytes -lt 50KB)  { $50KB++ }

    If ($_.TotalBytes -ge 50KB  -and $_.TotalBytes -lt 100KB) { $100KB++ }

    If ($_.TotalBytes -ge 100KB -and $_.TotalBytes -lt 256KB) { $256KB++ }

    If ($_.TotalBytes -ge 256KB -and $_.TotalBytes -lt 512KB) { $512KB++ }

    If ($_.TotalBytes -ge 512KB -and $_.TotalBytes -lt 1MB)   { $1MB++ }

    If ($_.TotalBytes -ge 1MB   -and $_.TotalBytes -lt 2MB)   { $2MB++ }

    If ($_.TotalBytes -ge 2MB   -and $_.TotalBytes -lt 5MB)   { $5MB++ }

    If ($_.TotalBytes -ge 5MB   -and $_.TotalBytes -lt 10MB)  { $10MB++ }

    If ($_.TotalBytes -ge 10MB  -and $_.TotalBytes -lt 15MB)  { $15MB++ }

    If ($_.TotalBytes -ge 15MB  -and $_.TotalBytes -lt 20MB)  { $20MB++ }

    If ($_.TotalBytes -ge 20MB  -and $_.TotalBytes -lt 30MB)  { $30MB++ }

    If ($_.TotalBytes -ge 30MB) { $big++ }


Write-Host “`n”

Write-Host “Less than 5KB:           $5KB”

Write-Host “Between 5KB   and 10KB:  $10KB”

Write-Host “Between 10KB  and 25KB:  $25KB”

Write-Host “Between 25KB  and 50KB:  $50KB”

Write-Host “Between 50KB  and 100KB: $100KB”

Write-Host “Between 100KB and 256KB: $256KB”

Write-Host “Between 256KB and 512KB: $512KB”

Write-Host “Between 512KB and 1MB:   $1MB”

Write-Host “Between 1MB   and 2MB:   $2MB”

Write-Host “Between 2MB   and 5MB:   $5MB”

Write-Host “Between 5MB   and 10MB:  $10MB”

Write-Host “Between 10MB  and 15MB:  $15MB”

Write-Host “Between 15MB  and 20MB:  $20MB”

Write-Host “Between 20MB  and 30MB:  $30MB”

Write-Host “Greater than  30MB:      $big”

Once it finishes, you will end up with an output similar to the one below showing how many e-mail fall into each category:

Less than 5KB:           1883

Between 5KB   and 10KB:  53513

Between 10KB  and 25KB:  116001

Between 25KB  and 50KB:  32772

Between 50KB  and 100KB: 13715

Between 100KB and 256KB: 8202

Between 256KB and 512KB: 4318

Between 512KB and 1MB:   3011

Between 1MB   and 2MB:   2209

Between 2MB   and 5MB:   1452

Between 5MB   and 10MB:  495

Between 10MB  and 15MB:  122

Between 15MB  and 20MB:  60

Between 20MB  and 30MB:  38

Greater than  30MB:      1

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top