Get-mailboxstatistics cmdlet gives Totalitemsize which is the mailbox size. But the totalitemsize doesn ' t contain the mailbox size in numbers, it ' s a PowerShell deserialized object.
This command displays the mailbox size from the Value property:
(get-mailboxstatistics-identity username). Totalitemsize.value
Example output:10.43 GB (11,202,063,583 bytes)
But what to do it usable in creating reporting or other purpose. Convert that value to a string, split at ' (' and take the first item in the split array. Here's the command that gives you usable mailbox size.
(get-mailboxstatistics-identity username). TotalItemSize.Value.ToString (). Split ("(") [0]
Example output:10.43 GB
If you want in the bytes, use the This cmdlet:
(get-mailboxstatistics-identity username). TotalItemSize.Value.ToString (). Split ("(") [1]. Split ("") [0]. Replace (",", "")
Example output:11202063583
Hope It is helpful for you.
Exchange:how to get Mailbox size in Exchange Shell?