During last few months, more than few times I received inquiry from clients, where they want list all mailboxes sorted by size.

For that action, approximately needed time is 5 minutes, if you know which PowerShell command you need to run.

Command Get-Mailbox | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select DisplayName, TotalItemSize will show you desired list.

<br />
DisplayName               TotalItemSize<br />
-----------               -------------<br />
Vladimir Stefanovic       24.73 GB (26,553,551,240 bytes)<br />
John Doe                  15.49 GB (16,630,213,681 bytes)<br />
User 01                   14.5 GB (15,566,374,992 bytes)<br />
User 02                    7.188 GB (7,717,571,477 bytes)<br />
Administrator              5.474 GB (5,877,998,363 bytes)<br />
Local Administrator        1.993 GB (2,139,826,545 bytes)<br />

If you want to export result to CSV file, just need to add one more pipe and command for exporting. Get-Mailbox | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select DisplayName, TotalItemSize | Export-Csv “path”.



2 thoughts on “List all Exchange mailboxes sorted by size

  1. Please Help me. I see your post, but I got error. How can I connect to Office 365 using local PowerShell. I use command Connect-MsolService, enter my credentials but got error. When enter your above command powershell told me that :The term ‘Get-Mailbox’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
    correct and try again.

  2. Hi Zoran,

    Cmdlet Connect-MsolService will connect you to your Office 365 tenant. If you want to connect to Exchange Online, you need to run following command.

    $UserCredential = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    Import-PSSession $Session

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.