locked
Why is "Get-MailboxStatistics -Database XXX" not reporting accurately on the mailboxes from that database? RRS feed

  • Question

  • Why is it that when I use the -Database flag with with the Get-MailboxStatistics cmdlet that it reports back on mailboxes that aren't in the specified database?  I am trying to organize about 15000 mailboxes by size, so I need to use the statistics to sort them.  If I run "Get-Mailbox -Database XXX -resultsize unlimited | measure -line" I will get a  result of 2401 for example, but "Get-MailboxStatistics -Database XXX | measure -line" returns 2679?  Upon investigation, many of the results from the Get-MailboxStatistics command are definately on a different database?

    I have tried to determine the greedy pattern to try and understand the behaviour, but I can't seem to see any logical reason for the extra results.

    Thanks in Advance,

    Byron

    • Moved by Marco Shaw Friday, November 25, 2011 11:18 PM (From:Windows PowerShell)
    Friday, November 25, 2011 7:23 PM

Answers

  • Hi Byron,
    The cmdlet get-mailboxstatistics shows active, disabled and soft-deleted mailboxes wheras get-mailbox only shows active once.
    So in other words if you have moved mailboxes to another database you would have a lot of soft-deleted mailboxes in the database. At least if you have Exchange 2010 SP1 installed, cause soft-deleted mailboxes is a new feature in that SP.

    Soft-deleted mailboxes: When mailboxes are moved from a Microsoft Exchange Server 2010 Service Pack 1 (SP1) database to any other database, Exchange doesn't fully delete the mailbox from the source database upon completion of the move. Instead, the mailbox in the source mailbox database is switched to a soft-deleted state.

    Understanding Disconnected Mailboxes
    http://technet.microsoft.com/en-us/library/bb232039.aspx

    You can deletete soft-deleted mailboxes with the cmdlet Remove-StoreMailbox
    http://technet.microsoft.com/en-us/library/ff829913.aspx

    To check if you have disabled and soft-deleted mailboxes in the database, run:
    Get-Mailboxstatistics -database "Database XX" | where {$_.Disconnectreason -ne "$null" | ft Displayname,*disconnect*

     


    Martina Miskovic - http://www.nic2012.com/
    • Proposed as answer by Terence Yu Monday, November 28, 2011 2:58 AM
    • Marked as answer by runBy Monday, November 28, 2011 8:00 PM
    Saturday, November 26, 2011 4:41 PM

All replies

  • What about if you use "| out file" with both cmdlet and count number of rows in excelsheet ??. Its weried for me also. I am too interested to know this behaviour.
    Anil MCC 2011,ITIL V3,MCSA 2003,MCTS 2010, My Blog : http://messagingschool.wordpress.com
    Saturday, November 26, 2011 10:37 AM
  • Hi Byron,
    The cmdlet get-mailboxstatistics shows active, disabled and soft-deleted mailboxes wheras get-mailbox only shows active once.
    So in other words if you have moved mailboxes to another database you would have a lot of soft-deleted mailboxes in the database. At least if you have Exchange 2010 SP1 installed, cause soft-deleted mailboxes is a new feature in that SP.

    Soft-deleted mailboxes: When mailboxes are moved from a Microsoft Exchange Server 2010 Service Pack 1 (SP1) database to any other database, Exchange doesn't fully delete the mailbox from the source database upon completion of the move. Instead, the mailbox in the source mailbox database is switched to a soft-deleted state.

    Understanding Disconnected Mailboxes
    http://technet.microsoft.com/en-us/library/bb232039.aspx

    You can deletete soft-deleted mailboxes with the cmdlet Remove-StoreMailbox
    http://technet.microsoft.com/en-us/library/ff829913.aspx

    To check if you have disabled and soft-deleted mailboxes in the database, run:
    Get-Mailboxstatistics -database "Database XX" | where {$_.Disconnectreason -ne "$null" | ft Displayname,*disconnect*

     


    Martina Miskovic - http://www.nic2012.com/
    • Proposed as answer by Terence Yu Monday, November 28, 2011 2:58 AM
    • Marked as answer by runBy Monday, November 28, 2011 8:00 PM
    Saturday, November 26, 2011 4:41 PM
  • Thanks Martina,

    Your answer was not only spot on, but also very informative!  I had tried to find an article that explained the problem from the cmdlet side, but your linked article makes it very plain by explaining it from the logical mailbox side.

    Running the Get-MailboxStatistics -database XX | where {$_.Disconnectreason -ne "$null" }| measure -line command returned more that 4000 soft deleted mailboxes on one database alone.  That makes perfect sense as I am attempting to sort ~15000 mailboxes by size so I am moving many of them around.

    Thanks again for the on-the-mark answer.

    Byron

    Monday, November 28, 2011 8:06 PM