size to MB RRS feed

  • Question

  • I am having a problem with a script.

    If I do

    get-mailboxstatistics -id xxx| select itemcount, totalitemsize

    I get the correct answers (i.e. no of items and the mailbox size in KB)

    I want to display the size in MB so I tried

    get-mailboxstatistics -id xxx| select itemcount, @{label="MB";expression={$_.totalitemsize.value.tomb()}}

    But I get a blank value and can't work out why. I have read quite a few different posts and it looks like I ave the right syntax but not the right result

    Any ideas?



    Wednesday, February 11, 2015 2:56 PM


  • If you're trying to do this in a script, I would pipe the results to a variable first 

    $mbstats = Get-MailboxStatistics xxx | Select-Object TotalItemSize, ItemCount, .....

    Then I would manipulate the total item size either right after this, or when I go to display it, then this should work:


    or if you want to do it in one line try:

    Get-MailboxStatistics xxx | Select-Object itemcount, totalitemsize | Select-Object ItemCount, @{label="MB";expression={$_.totalitemsize.value.tomb()}}

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread

    • Proposed as answer by Hinte Tuesday, February 17, 2015 8:55 PM
    • Marked as answer by UKMorite Monday, February 23, 2015 11:45 AM
    Wednesday, February 11, 2015 3:16 PM