locked
Powershell - How many mailboxes RRS feed

  • Question

  • one forest, two domains using Exchange 2010.  With the command Get-MailboxDatabase -Status to find out how many mailboxes in a database I only get the amount of mailboxes from one of the domains.  What do I add to it in order to get the info from both domains?
    Tuesday, July 17, 2012 8:52 PM

Answers

  • Use the Set-AdServerSettings cmdlet before your Get-MailboxDatabase call, or put it in your $Profile:

    Set-AdServerSettings -ViewEntireForest $true

    While I'm at it, if you mearly want to get a count of mailboxes, you can do it like this:

    (Get-Mailbox -Database <foo>).Count
    Karl

    (Set-AdServerSettings is on page 332 of my book) ;)


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer



    My Blog: http://unlockpowershell.wordpress.com
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})

    • Marked as answer by SandySZ Thursday, July 19, 2012 8:15 PM
    Tuesday, July 17, 2012 9:18 PM

All replies

  • Use the Set-AdServerSettings cmdlet before your Get-MailboxDatabase call, or put it in your $Profile:

    Set-AdServerSettings -ViewEntireForest $true

    While I'm at it, if you mearly want to get a count of mailboxes, you can do it like this:

    (Get-Mailbox -Database <foo>).Count
    Karl

    (Set-AdServerSettings is on page 332 of my book) ;)


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer



    My Blog: http://unlockpowershell.wordpress.com
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})

    • Marked as answer by SandySZ Thursday, July 19, 2012 8:15 PM
    Tuesday, July 17, 2012 9:18 PM
  • Try running this before running the cmdlet.

    $AdminSessionADSettings.ViewEntireForest = $true


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

    Tuesday, July 17, 2012 9:21 PM
  • Hi Sandy

    Did you try above cmdlet?

    Cheers


    Zi Feng

    TechNet Community Support

    Thursday, July 19, 2012 8:02 AM
    Moderator