I'm trying to get the sum of the TotalItemSize
for an Exchange database using the command
Get-MailboxStatistics -Database MBX07 | Measure-Object -Sum TotalItemSize
The command works perfectly fine in the Windows PowerShell ISE but if I run it in an Exchange EMS (both are on my local machine) I get errors for every mailbox in the database that say
Measure-Object : Input object "8.518 MB (8,932,049 bytes)" is not numeric.
The output in the ISE where the command works looks like
Count : 174
Average :
Sum : 203481256406
Maximum :
Minimum :
Property : TotalItemSize
It's an Exchange 2010 SP1 server running on Windows Server 2008 R2 and I'm running Windows 8.1 64bit
Any help is greatly appreciated
This was run from my EMC on my server.
Get-MailboxStatistics -Database MBX07 | ForEach-Object {[Microsoft.Exchange.Data.ByteQuantifiedSize]::Parse($_.TotalItemSize)} | Measure-Object -sum
TotalItemSize
is of type Microsoft.Exchange.Data.ByteQuantifiedSize
so we use its method Parse
to get a value we can put into -sum
BONUS
You can try this which will output the Sum in MB
Get-MailboxStatistics -Database MBX07 | ForEach-Object {
([Microsoft.Exchange.Data.ByteQuantifiedSize]::Parse($_.TotalItemSize)).ToMb()
} | Measure-Object -sum