When managing a Microsoft Exchange 2003 server it is quite easy to determine the mailbox sizes of your various users, just use the ESM (Exchange System Manager). Unfortunately, moving to Exchange 2007 makes this simple task a bit more cumbersome. You must now use the PowerShell to determine mailbox sizes and other statistics. The cmdlet that we will use is Get-MailboxStatistics.
The basic command to return mailbox sizes using the PowerShell is as follows:
Get-MailboxStatistics | FL DisplayName,TotalItemSize,ItemCount
This command will output users display names, their mailbox sizes in bytes and the total item count for the mailbox. Whie this is information is usefull it is not sorted and can’t be filtered. The nice thing about the PowerShell is it’s flexibility. Should we want to return mailbox statistics for all users with more than 100 MB of data in their mailboxes we could run the following command.
Get-MailboxStatistics |where {$_.TotalItemSize -gt 100MB} | sort $_.TotalItemSize |FT DisplayName,TotalItemSize,ItemCount
Should you want this mailbox information sorted you would could use the following command.
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label=”TotalItemSize(KB)”;expression={$_.TotalItemSize.Value.ToKB()}},ItemCount
As you can see, we are now sorting by the TotalItemSize in descending order and telling the PowerShell to return mailbox sizes in KB instead of bytes.
For more information about returning mailbox sizes and statistics in Exchange 2007 see the Microsoft Exchange Server TechCenter.