0

i have written a one-liner to sum up the space of all Exchange Mailboxes. It's like

[PS] C:\Windows\system32>Get-Mailbox  | where {$_.RecipientType -eq "UserMailBox"} | Get-MailboxStatistics | measure-Obj
ect -Property TotalItemSize -sum
Measure-Object : Das Eingabeobjekt "42.32 MB (44,377,424 bytes)" ist nicht numerisch.
Bei Zeile:1 Zeichen:99
+ Get-Mailbox  | where {$_.RecipientType -eq "UserMailBox"} | Get-MailboxStatistics | measure-Object <<<<  -Property To
talItemSize -sum
    + CategoryInfo          : InvalidType: (42.32 MB (44,377,424 bytes):Unlimited`1) [Measure-Object], PSInvalidOperat
   ionException
    + FullyQualifiedErrorId : NonNumericInputObject,Microsoft.PowerShell.Commands.MeasureObjectCommand

which, as seen, is not working cause the output of that Object is not a numeric value. So, how to get the SUM working?

1
  • 1
    Use a property that is numeric. Run ... | Get-MailboxStatistics | Get-Member to see what is available. Jun 29, 2022 at 12:21

1 Answer 1

0

Since TotalItemSize is of type Microsoft.Exchange.Data.ByteQuantifiedSize try the following:

Get-Mailbox -RecipientTypeDetails UserMailbox | Get-MailboxStatistics | ForEach-Object {[Microsoft.Exchange.Data.ByteQuantifiedSize]::Parse($_.TotalItemSize)} | Measure-Object -Sum
1
  • And i hoped that there is a more easy solution. Just a output in Byte as default, but seems not.
    – Chris9834
    Jul 6, 2022 at 8:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .