How to check the size of each mailbox in Microsoft Exchange

To check the size of each mailbox in Microsoft Exchange or Office 365 using PowerShell, follow these steps:

1. Open PowerShell as Administrator

For Office 365, you’ll need to use the Exchange Online PowerShell module.

2. Connect to Exchange Online (Office 365)

Use the following commands to connect to Office 365:

powershellCopy code$UserCredential = Get-Credential
Connect-ExchangeOnline -UserPrincipalName $UserCredential.UserName -ShowProgress $true

If you’re using an on-premises Exchange server, skip this step and proceed with the next.

3. Run PowerShell Commands to Check Mailbox Size

After connecting, use one of the following commands depending on what information you need.

3.1 Check Mailbox Size for All Users

This command will list the mailbox sizes for all users:

powershellCopy codeGet-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select DisplayName, TotalItemSize, ItemCount | Sort-Object TotalItemSize -Descending
  • DisplayName: Shows the mailbox owner’s name.
  • TotalItemSize: Displays the size of the mailbox.
  • ItemCount: Shows the number of items in the mailbox.

3.2 Check Mailbox Size for a Specific User

To check the mailbox size for a specific user, use their email address:

powershellCopy codeGet-MailboxStatistics -Identity "user@example.com" | Select DisplayName, TotalItemSize, ItemCount

Replace user@example.com with the user’s actual email address.

3.3 Export Mailbox Size to CSV

If you want to export the results to a CSV file for further analysis, use the following command:

powershellCopy codeGet-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select DisplayName, TotalItemSize, ItemCount | Sort-Object TotalItemSize -Descending | Export-Csv -Path "C:\MailboxSizeReport.csv" -NoTypeInformation

This will generate a CSV file (MailboxSizeReport.csv) in the specified directory.

4. Disconnect from Exchange Online

Once you’ve finished, disconnect from Exchange Online:

powershellCopy codeDisconnect-ExchangeOnline -Confirm:$false

Additional Notes:

  • If you’re using on-premises Exchange, you don’t need to connect to Exchange Online; simply open PowerShell on the Exchange server and use the same Get-MailboxStatistics cmdlet.
  • You can modify the script to filter by date, mailbox database, or other attributes depending on your needs.

Published by

Bob Lin

Bob Lin, Chicagotech-MVP, MCSE & CNE Data recovery, Windows OS Recovery, Networking, and Computer Troubleshooting on http://www.ChicagoTech.net How to Install and Configure Windows, VMware, Virtualization and Cisco on http://www.HowToNetworking.com

Leave a Reply

Your email address will not be published.