locked
Exchange command for SUM of all mailboxes RRS feed

  • Question

  • hello,

    i am using the following command for a overview of all mailbox-sizes:

    Get-MailboxStatistics |  | ft DisplayName,@{label="TotalItemSize(KB)";expression={$_.TotalItemSize.Value.ToKB()}},ItemCount

    Now i want to SUM all these mailboxes so i know the overall mail-size.

    The mailbox-db can`t be defragmented so i want to do this by an exchange-command.

    Anybody with a ems-command for this?

    Thx

    Tuesday, August 11, 2015 9:12 AM

Answers

  • I assume the empty pipe you have was taken care of and your command looks more like the following:

    Get-MailboxStatistics |  ft DisplayName,@{label="TotalItemSize(KB)";expression={$_.TotalItemSize.Value.ToKB()}},ItemCount

    To get the sum of all mailboxes, change your command to the following code:

    $AllMbxData = Get-Mailbox -ResultSize Unlimited | Sort Alias | Get-MailboxStatistics | % {
        $MbSize = $_.TotalItemSize.Value.ToKB()
    } | Select DisplayName,@{label="TotalItemSize(KB)";expression={$MbSize}},ItemCount
    $AllMbxData | Ft
    $AllMbxData | Measure "TotalItemSize(KB)" -Sum -Average -Minimum -Maximum

    This code stores the information about all your mailboxes in a variable, then displays that data.  It then shows the count, sum, average, max and min of the mailbox sizes.


    Will Martin ...
    -join ('77696c6c406d617274696e2d66616d696c6965732e6f7267' -split '(?<=\G.{2})' | ? { $_ } | % { [char][int]"0x$_" })

    • Proposed as answer by Allen_WangJF Wednesday, August 12, 2015 6:54 AM
    • Marked as answer by Allen_WangJF Wednesday, September 9, 2015 2:26 AM
    Tuesday, August 11, 2015 1:16 PM

All replies

  • I assume the empty pipe you have was taken care of and your command looks more like the following:

    Get-MailboxStatistics |  ft DisplayName,@{label="TotalItemSize(KB)";expression={$_.TotalItemSize.Value.ToKB()}},ItemCount

    To get the sum of all mailboxes, change your command to the following code:

    $AllMbxData = Get-Mailbox -ResultSize Unlimited | Sort Alias | Get-MailboxStatistics | % {
        $MbSize = $_.TotalItemSize.Value.ToKB()
    } | Select DisplayName,@{label="TotalItemSize(KB)";expression={$MbSize}},ItemCount
    $AllMbxData | Ft
    $AllMbxData | Measure "TotalItemSize(KB)" -Sum -Average -Minimum -Maximum

    This code stores the information about all your mailboxes in a variable, then displays that data.  It then shows the count, sum, average, max and min of the mailbox sizes.


    Will Martin ...
    -join ('77696c6c406d617274696e2d66616d696c6965732e6f7267' -split '(?<=\G.{2})' | ? { $_ } | % { [char][int]"0x$_" })

    • Proposed as answer by Allen_WangJF Wednesday, August 12, 2015 6:54 AM
    • Marked as answer by Allen_WangJF Wednesday, September 9, 2015 2:26 AM
    Tuesday, August 11, 2015 1:16 PM
  • You can also take a look AvailableNewMailboxSpace on each database to see how much white space it has...

    Get-MailboxDatabase -Status | select name, availablenewmailboxspace


    Amit Tank | Exchange - MVP | Blog: exchangeshare.wordpress.com 

    Wednesday, August 12, 2015 1:10 AM
  • Hi Amit,

    thx for your answer, but on exchange 2007 this is the result:

    Wednesday, August 12, 2015 6:28 AM
  • Mvd, Exchange 2007 uses an event to show available whitespace.  See https://technet.microsoft.com/en-us/library/aa996139%28v=exchg.65%29.aspx for details.

    Will Martin ...
    -join ('77696c6c406d617274696e2d66616d696c6965732e6f7267' -split '(?<=\G.{2})' | ? { $_ } | % { [char][int]"0x$_" })

    Wednesday, August 12, 2015 1:33 PM