One nice feature in Exchange 201x PowerShell is the ability to easily list all mailboxes and their size in Megabytes (MB). Why is this important? Simply put, consistency of data and ease of comparing mailboxes. How do we do this?
[SourceCode Language=”PowerShell”]
Get-Mailbox | Get-MailboxStatistics | Select-Object DisplayName, {$_.TotalItemSize.Value.ToMB()}
[/SourceCode]
Notice the ‘Value.ToMB’ portion of the code. This is the portion that converts the size from the size’s raw data into Megabytes. What does this look like in practice?
OK. So, we have the value converted, but the column header is ugly. We can fix that with this code:
[SourceCode Language=”PowerShell”]
Get-Mailbox | Get-MailboxStatistics | Select-Object DisplayName,@{Expression={$_.TotalItemSize.Value.ToMB()};Label="Mailbox Size(MB)"}
[/SourceCode]
This then looks much better:
What happens when we try this in Exchange Online?
Wait. Wut? How do we fix this? Simple. We need to use the new ExO v2 cmdlets that Microsoft has provided for us. Find more information on that module here:
http://www.powershellgeek.com/exchange-online-v2-cmdlets-part-one-prerequisites/
http://www.powershellgeek.com/exchange-online-v2-cmdlets-part-two-module-and-new-cmdlets/
Exchange Online – ToMB is Back!
Categories: