Click an Ad

If you find this blog helpful, please support me by clicking an ad!

Friday, July 18, 2014

Powershell - Exchange Mailbox Size Reports and Bonus Rant

We limit our users to 1GB mailboxes. If they're high up in the chain we'll let them go to 3GB mailboxes. We do run a Barracuda Email Archiver with a 6 year retention policy, and allow our users to make their own PSTs if they need to (but only with the knowledge that IT will not help them recover or backup PST files).

I have talked to a lot of email admins and a lot have no mailbox size limits at all or a very high limit. The consensus seems to be that our limits are ridiculous. If you have an opinion on this, I'd love to hear from you, but my take is that, seriously, do you really need to keep all of that mail? Be judicious. It's my opinion that if all of these digital documents were converted into actual pieces of paper there would be a sea-change in users' attitudes with regard to email and files in general. I mean seriously, if the documents took up actual physical space, you'd get rid of things that you don't need, as opposed to spending the money for lateral file cabinets and a warehouse to hold all of this crap. Delete the office jokes and the cat pictures. If there's a long chain of emails, save the last one.

Saving all of this stuff digitally has real costs. The amount of space required (and SAN space is not cheap). If you want your IT department to implement some sort of document lifecycle and automate what each user could easily do, bear in mind that those systems are not cheap and are not painless to implement. Also, we have to back all that crap up, so there's backup storage. Now the backup solution has to churn through more data during a static backup window, and speed can be expensive.

Ok, I'm done with my rant. Here's what I use to keep tabs on my top mailbox sizes. I am running Exchange 2010.

#----------------------BEGIN SCRIPT-----------------------------------
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

function Get-DatabaseStatistics {
$Databases = Get-MailboxDatabase -Status
foreach($Database in $Databases) {
    $DBSize = $Database.DatabaseSize
    $MBCount = @(Get-MailboxStatistics -Database $Database.Name).Count
    $MBAvg = Get-MailboxStatistics -Database $Database.Name | %{$_.TotalItemSize.value.ToMb()} | Measure-Object -Average          
    New-Object PSObject -Property @{
        Server = $Database.Server.Name
        DatabaseName = $Database.Name
        LastFullBackup = $Database.LastFullBackup
        MailboxCount = $MBCount
        "DatabaseSize (MB)" = $DBSize.ToMB()
        "AverageMailboxSize (MB)" = $MBAvg.Average
        "WhiteSpace (MB)" = $Database.AvailableNewMailboxSpace.ToMb()
        } #End New-Object
    } #End Foreach
} #End Get-DatabaseStatistics Function

Get-DatabaseStatistics | Export-Csv c:\temp\report.csv -Force -NoType

Send-MailMessage -To -From -Subject "Database Statistics for $((get-date).ToShortDateString())" -SmtpServer -Attachments c:\temp\report.csv

Remove-Item c:\temp\report.csv

#----------------------END SCRIPT-----------------------------------


  1. Charles, have you tried vCheck for Exchange? Monday morning when I get in I have an email waiting for me.

    Regarding limits - we set it at 1.5GB per user. However PST's are EVERYWHERE!! I have a user with 60GB of archived PST's! I think I need to work out cost per GB for storage, including backup costs then attack it that way.

    Seriously, why does anyone keep Exchange meeting acceptance emails from 2005...

  2. I will definitely check out vCheck, thanks!

  3. "If there's a long chain of emails, save the last one"
    I'd have to disagree with this one, as last chains don't always contain the attachments used within the chain.
    When do you think you would, if ever, migrate to Google Apps/365/Off-premise? On-premise maintenance becomes quite annoying, especially with larger storage requirements