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
source to share
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
source to share