PowerShell Get-MailboxStatistics For Exchange Mailbox Size
With Get-MailboxStatistics you get a report on the size of the mailboxes, the number of messages they contain, and when each was last accessed. Very often this is too much information, therefore you need to master the -Server or even the -Identity parameter.
- Getting Started with Get-MailboxStatistics
- List the Get-MailboxStatistics Parameters
- Get-MailboxStatistics TotalItemSize Property
♣
Getting Started with Get-MailboxStatistics
Get-MailboxStatistics is an ideal command for taking your first tentative steps using PowerShell on an Exchange server. Launch PowerShell, I favour the ISE GUI version, and type:
Get-MailboxStatistics
List the Get-MailboxStatistics Parameters
PowerShell is full of goodness. In this instance you can get kill two birds with one stone, get more specific data as you learn about this cmdlet’s parameters.
Get-Help Get-MailboxStatistics
Use the parameters displayed by Get-Help to reduce the output to just database DB01:
Get-MailboxStatistics -Database DB02
See SolarWinds Storage Response Time Monitor ยป
Here is another useful parameter:
Get-MailboxStatistics -Server ExchMbx1
Get the stats for one particular user:
Get-MailboxStatistics -Identity "Mary Evans"
Get-MailboxStatistics TotalItemSize Property
Let us employ PowerShell to report on the mailbox size. Incidentally, I discovered the TotalItemSize property by calling for Get-Member, this is what I tried:
Get-MailboxStatistics -Identity "Mary Evans" `
| Get-Member
This is how I put the new knowledge into practice:
#PowerShell Gets Exchange 2010 Mailbox Size
Get-MailboxStatistics -Identity "Mary Evans" `
| Format-Table DisplayName, TotalItemSize
Convert TotalItemSize – To MB
A minor irritation with TotalItemSize is that the units are very small, namely bytes. Fortunately, further research with Get-Member reveals a method (not a property) called ToMB(). It’s a bit of a struggle, but you can persuade PowerShell to display the Size in Megabytes with: @{label="Mailbox Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}
Get-MailboxStatistics -Identity "Mary Evans" `
| Format-Table DisplayName, `
@{label="Mailbox Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}
Guy Recommends: The SolarWinds Exchange Monitor
Here is a free tool to monitor your Exchange Server. Download and install the utility, then inspect your mail queues, monitor the Exchange server’s memory, confirm there is enough disk space, and check the CPU utilization.
This is the real deal – there is no catch. SolarWinds provides this fully-functioning freebie, as part of their commitment to supporting the network management community.
Free Download of SolarWinds Exchange Monitor
Compare PowerShell with the EMC![Get-MailboxStatistics PowerShell cmdlet](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMjMiIGhlaWdodD0iMTU2IiB2aWV3Qm94PSIwIDAgMzIzIDE1NiI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgc3R5bGU9ImZpbGw6I2NmZDRkYjtmaWxsLW9wYWNpdHk6IDAuMTsiLz48L3N2Zz4=)
From a learning point-of-view it it’s worth a walk-through in the Exchange Management Console (EMC), the benefit is you can compare the PowerShell script with what you see in the Exchange GUI.
- Launch the EMC, navigate to the Recipient Configuration, Mailbox (see right).
Note 3: See more on PowerShell’s Get-MailboxStatistics.
Summary of Get-MailboxStatistics
Get-MailboxStatistics is a suitable command for learning about how PowerShell can interrogate Exchange. Not only is it useful on its own, but
Get-Help Get-MailboxStatistics
will reveal useful parameters such as -Server, -Identity and -Database. Also how to display Exchange 2010 mailbox size in MB with TotalItemSize.
If you like this page then please share it with your friends
See more PowerShell Cmdlets for Exchange 2010:
• Exchange 2010 Home • Get-ExchangeServer • Set-ExchangeServer • New-SystemMessage • SP1
• Get-Mailbox • Get-MailboxStatistics • Connect-Mailbox • Enable-Mailbox • Disable-Mailbox
• PowerShell Exchange Cmdlets • Set-Contact • New-Mailcontact • Add-MailboxPermission -identity