Home

Exchange 2010: Mailbox Size

Posted by SteveHardie | On: Jul 04 2013

This post demonstrates how you can use Exchange Powershell to list and export user mailbox size, including deleted items size.

Run the command below to generate a list of all users, what databse their mailbox is stored in, the TotalItemSize, and TotalDeletedItemSize (Storage space used in the recoverable items folder)

Get-MailBox | Get-MailboxStatistics | select DisplayName,DatabaseName,TotalItemSize,TotalDeletedItemSize,StorageLimitStatus

To export these statistics to a CSV file, append | Export-CSV $strFileName to the end of the command.

Get-MailBox | Get-MailboxStatistics | select DisplayName,DatabaseName,TotalItemSize,TotalDeletedItemSize,StorageLimitStatus | Export-CSV $strFileName

To sort the results in order of size, you can use the Sort-Object parameter

Get-MailBox | Get-MailboxStatistics | select DisplayName,DatabaseName,TotalItemSize,TotalDeletedItemSize,StorageLimitStatus | Sort-Object TotalItemSize -Descending

See Also:
Get-MailboxStatistics

2 Comments

  1. Gary Levon says:

    This script worked great

  2. Shiva Sharma says:

    Problem is, Get-MailboxStatistics output just a display name – not unique and cant really be used as such. The other half of the information you need is in Get-Mailbox :- found answer in following link. once you have the data on all your mailboxes, and the output can be IMPORTED into excel you can do all your sorting etc and delete whatever you dont want

    ***if this is what you were looking for, please click this link and give the guy some credit.. i didnt come up with this, i just found it

    #REM http://www.experts-exchange.com/Software/Server_Software/Email_Servers/Exchange/Q_27828458.html

    $Mailboxes = Get-Mailbox -ResultSize Unlimited
    foreach ($Mailbox in $Mailboxes)
    {
    $Mailbox | Add-Member -MemberType “NoteProperty” -Name “MailboxSizeMB” -Value ((Get-MailboxStatistics $Mailbox).TotalItemSize.Value.ToMb())
    }
    $Mailboxes | Sort-Object MailboxSizeMB -Desc | Select PrimarySMTPAddress, MailboxSizeMB

    #REM – to export this out — do the following 😉 enjoy (see the part where it says “Select” you can add additional fields like ALIAS etc to this)

    $Mailboxes = Get-Mailbox -ResultSize Unlimited
    foreach ($Mailbox in $Mailboxes)
    {
    $Mailbox | Add-Member -MemberType “NoteProperty” -Name “MailboxSizeMB” -Value ((Get-MailboxStatistics $Mailbox).TotalItemSize.Value.ToMb())
    }
    $Mailboxes | Sort-Object MailboxSizeMB -Desc | Select PrimarySMTPAddress, MailboxSizeMB | Export-Csv -NoType “C:\temp\Mailboxessize.csv”

Leave a comment