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

One Response to Show the size of mailboxes in MB

  1. king says:

    Dearest one,

    I know you may have been contacted in the past and your help solicited concerning an inheritance and may be it turned out to be a scam. I was a servant at the presidential palace in Burkina Faso until when the president was overthrown. Presently we are in Cote d’Ivoire and the president is in hiding here. He asked me to seek your assistance to help us move some money abroad. If you feel you can help us, kindly reply. If however you are not willing to help us, please do not expose what I have revealed to you.

    I look forward to your quick response

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: