Home » Mailboxes

Tag: Mailboxes

PowerShell Tip: Get a List of the Top Exchange Server Mailboxes by Size

Reader Faisal asks about retrieving a list of the top 30 mailboxes in order of size.

Finding the top (or largest) mailboxes in the Exchange Server organization is a fairly common requirement. I’m often asked to produce such lists by managers when issues of server capacity get raised.

In fact, it is why I wrote the Get-MailboxReport.ps1 script, which I recommend you download.

But, in the interests of learning about PowerShell, let’s also take a look at doing it manually. Fortunately this is quite a simple report to generate using PowerShell.

You might already be familiar with the Get-MailboxStatistics cmdlet, for example:

Get-MailboxStatistics returns an object made up of various properties that describe the mailbox statistics for the mailbox. We can take a closer look at these properties using Get-Member.

Of particular interest if we want to find the largest mailboxes is the TotalItemSize property. We can sort on that property using Sort-Object, and then use Select-Object to only return the top X number of results.

As a one-liner this breaks down as follows:

  • A Get-Mailbox or Get-MailboxDatabase depending on the scope of our investigation
  • The output from either of the above cmdlets piped into Get-MailboxStatistics
  • The output from Get-MailboxStatistics piped into Sort-Object
  • Select-Object to return only the desired number of results, and optionally to return only the specific properties we want to see in our final output
  • Optionally again, an export to file

Example #1 – Select top 30 mailboxes by totalitemsize

Example #2 – Select top 100 mailboxes by totalitemsize and export to CSV file

The resulting CSV file:

Hopefully that answers your question Faisal, but once again you’re welcome to download and use the Get-MailboxReport.ps1 script for this type of mailbox size reporting.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.