none
powershell commnd to count the number of mailboxes per database in Exchange 2010 RRS feed

  • Question

  • Guys,

    Do yu have any script or powershell command to display the number of mailbox count per database, database size and last backup report.

     

    Regards

    Krishna S

    Monday, December 19, 2011 4:43 PM

Answers

  • Hi Krishna,

    Database size and last backup:

    (get-mailboxdatabase -status) | foreach-object {write-host $_.lastfullbackup $_.databasesize}

    Mailboxes

    (get-mailboxdatabase) | foreach-object {write-host $_.name (get-mailbox -database $_.name).count}

    you could combine this as well.

    Regards,

    Chris

    Monday, December 19, 2011 5:21 PM
  • Hi
    PLease Try the script, it will display all the exchange server in the domain, and their database, and the number of its mailbox


    $exchservers = Get-Exchangeserver
    foreach($exchserver in $Exchservers)
    {
    get-mailbox -Server $exchserver.name | Group-Object Database | Select-object Count,Name,Databasesize,Lastfullbackup
    $exchserver.name
    }

    Cheers
    Zi Feng

    Tuesday, December 20, 2011 2:12 AM

All replies

  • Hi Krishna,

    I would suggest Stevies Environment Report:

    http://www.stevieg.org/2011/06/exchange-environment-report/

    it contains everything you want - and even much more.

    Regards,

    Chris

    Monday, December 19, 2011 4:48 PM
  • Hello Chris

     

    Thanks for your response.

    Forgot to mention , I have been already visited the link which was suggested by you. I have access to very few servers and the steve report takes hours to run and I do not want report for my environment.

    Do you have any handy commands to run ?

     

    Reagrds

    Krishna

    Monday, December 19, 2011 4:59 PM
  • Hi Krishna,

    Database size and last backup:

    (get-mailboxdatabase -status) | foreach-object {write-host $_.lastfullbackup $_.databasesize}

    Mailboxes

    (get-mailboxdatabase) | foreach-object {write-host $_.name (get-mailbox -database $_.name).count}

    you could combine this as well.

    Regards,

    Chris

    Monday, December 19, 2011 5:21 PM
  • Hi
    PLease Try the script, it will display all the exchange server in the domain, and their database, and the number of its mailbox


    $exchservers = Get-Exchangeserver
    foreach($exchserver in $Exchservers)
    {
    get-mailbox -Server $exchserver.name | Group-Object Database | Select-object Count,Name,Databasesize,Lastfullbackup
    $exchserver.name
    }

    Cheers
    Zi Feng

    Tuesday, December 20, 2011 2:12 AM
  • Hi,

    i have tried to run your script, i'm only able to get the returns for count and name.. i not abe to get the returns for "Databasesize" and "Lastfullbackup" ..

    Also, is it possible to add "AvailableNewMailboxSpace" ?

    $exchservers = Get-Exchangeserver
    foreach($exchserver in $Exchservers)
    {
    get-mailbox -Server $exchserver.name | Group-Object Database | Select-object Count,Name,Databasesize,Lastfullbackup
    $exchserver.name
    }

    --------------

    [PS] C:\Windows\system32>foreach($exchserver in $Exchservers)
    >> {
    >> get-mailbox -Server $exchserver.name | Group-Object Database | Select-object Count,Name,Databasesize,Lastfullbackup
    >> $exchserver.name
    >> }
    >>

                            Count Name                          Databasesize                  Lastfullbackup
                            ----- ----                          ------------                  --------------
                                1 MXDAG01-TEMP
                               82 MXDAG01-DB01
                               42 MXDAG01-DB02
    MXDF01EXC001
                              182 USDAG01-DB01
                              399 USDAG01-DB02
    USNJ01EXC003
                               87 USDAG01-DB04
                              450 USDAG01-DB03
                               32 USDAG01-DB02
                                2 USDAG01-DB07
                                1 USDAG01-DB01
    USNJ01EXC004
                                2 USDAG01-JN01

    Monday, April 28, 2014 5:36 PM
  • Also, where do i insert this

    -resultsize "Unlimited"  ?

    • Proposed as answer by romeo.zw Thursday, August 14, 2014 7:43 AM
    • Unproposed as answer by romeo.zw Thursday, August 14, 2014 7:44 AM
    • Proposed as answer by romeo.zw Thursday, August 14, 2014 7:44 AM
    • Unproposed as answer by romeo.zw Thursday, August 14, 2014 7:45 AM
    • Proposed as answer by romeo.zw Thursday, August 14, 2014 7:46 AM
    Monday, April 28, 2014 5:37 PM
  • try this one:

    Get-MailboxServer|foreach{Get-MailboxDatabase-status|selectserver,name,backupinprogress,lastfullbackup,@{n="Mailboxes";e={$_.count}},@{N="DatabaseSize GB";E={"$([math]::round($_.DatabaseSize.Tobytes()/1Gb,2))GB"}}} |ft

    Thursday, August 14, 2014 7:47 AM
  • I know I am 2 year late and you might have already some solution in place, but this is for any one new searching an answer.

    To get status of last full backup, availablewhitespace, mailbox count on a mailbox database on Exchange servers.

    (get-mailboxdatabase) | foreach-object {Get-mailboxdatabase -id $_.name -status -ea silentlyContinue -WarningAction silentlyContinue | Select-object  name, @{Label='TotaluserCount';expression={(get-mailbox -database  $_.name  -resultsize unlimited -WarningAction silentlycontinue).count}} ,Lastfullbackup, AvailableNewMailboxSpace }


    Thursday, March 17, 2016 12:45 PM