Mailbox size report
Documentation: Microsoft Learn
Use Get-EXOMailboxStatistics to report mailbox item counts and total sizes, then sort the results to inspect the largest mailboxes first.
The script
Script reader
Inspect before you run
Inspect the script below. It does not run in this browser.
Inspection only — no command has run.
Show reference output
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-EXOMailbox -ResultSize Unlimited | Get-EXOMailboxStatistics | Select-Object DisplayName,ItemCount,TotalItemSize | Sort-Object TotalItemSize -Descending- Stage 1Get-EXOMailboxStatistics
-ResultSize - Stage 2Select-Object
Positional values or no named parameters - Stage 3Sort-Object
-Descending
How it works
Get-EXOMailboxStatistics returns per-mailbox usage figures, the projection keeps the display name with ItemCount and TotalItemSize, and Sort-Object orders by size descending so the heaviest mailboxes surface first.
Adapting it
Feed it explicitly from a mailbox list, since these statistics cmdlets expect an identity: pipe Get-EXOMailbox -ResultSize Unlimited into Get-EXOMailboxStatistics so every mailbox is requested by name.
Requirements
ExchangeOnlineManagement module with a Connect-ExchangeOnline session.
If the result is unexpected
Mailbox size sorting looks wrong or returns blank values.
Size values may be formatted objects or strings rather than numeric bytes, and some statistics may be unavailable.
- Inspect the returned size type for one mailbox and convert to a consistent numeric unit before sorting.
Validate the result
Sorted values follow numeric size order and missing statistics are marked unknown.
Keep the check reliable
Preserve bytes for calculation and create readable size labels only for presentation.