Show the size of mailboxes in MB
2009-06-24 Leave a comment
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…
