Get the sum of Exchange mailbox statistics

I am trying to get the sum TotalItemSize

for an Exchange database using the command

Get-MailboxStatistics -Database MBX07 | Measure-Object -Sum TotalItemSize

The command works fine in Windows PowerShell ISE, but if I run it in Exchange EMS (both are on my local machine) I get errors for each mailbox in the database that say

Measure-Object: The input object "8.518 MB (8,932,049 bytes)" is not Numeric.

The result in the ISE where the team is working looks like

Count    : 174
Average  : 
Sum      : 203481256406
Maximum  : 
Minimum  : 
Property : TotalItemSize

      

This is Exchange 2010 Service Pack 1 (SP1) running on Windows Server 2008 R2 and I am running Windows 8.1 64bit

Any help is appreciated

+3


source to share


2 answers


This was done from my EMC on my server.

Get-MailboxStatistics -Database MBX07 | ForEach-Object {[Microsoft.Exchange.Data.ByteQuantifiedSize]::Parse($_.TotalItemSize)} | Measure-Object -sum

      

TotalItemSize

has a type Microsoft.Exchange.Data.ByteQuantifiedSize

, so we use its method Parse

to get a value that we can put in-sum

More about it here



BONUS

You can try this which will output Sum to MB

Get-MailboxStatistics -Database MBX07 | ForEach-Object {
     ([Microsoft.Exchange.Data.ByteQuantifiedSize]::Parse($_.TotalItemSize)).ToMb()
     } | Measure-Object -sum

      

+2


source


A bit more native PowerShell, instead of calling a .NET method with ::



Get-Mailbox -Database "DB1" | Get-MailboxStatistics | ForEach-Object {$ _. TotalItemSize.Value.ToGb ()} | Measure-Object -sum

0


source







All Articles