Show the size of mailboxes in MB

This is how to get the mailbox size for all users and convert it to MB, there’s no point in getting it in Bytes if you ask me.
Get-MailboxStatistics | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}

And sorting it descending:
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}

And showing the number of items:
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

And if you only want the information for a specific mailbox:
Get-MailboxStatistics –Identity <MailboxDisplayName> | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

But if you got a large number of users this really only makes sense if we export the output to a csv:
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select DisplayName,@{name="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount | Export-CSV C:\Mailboxsize.csv

If you only want information from the mailboxes in a specific database:
Get-MailboxStatistics –Database <Name of Database> | Sort-Object TotalItemSize -Descending | Select DisplayName,@{name="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

I will continue this theme in the next couple of days with information on retrieving mailbox database size…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: