For an Exchange administrator there are a lot of different situations in which they may need to know how many mailboxes are in the organization.  Fortunately this is made easy in Exchange Server 2010 with a few simple PowerShell commands.

To get a count of all mailboxes in the Exchange 2010 organization use the following command:

[PS] C:\>(Get-Mailbox).count

Note that if you know your organization has over 1000 mailboxes you need to make sure that the result size of the command output is not limited.

[PS] C:\>(Get-Mailbox -resultsize unlimited).count

Next, we can get a count of mailboxes per Exchange 2010 mailbox server.

[PS] C:\>Get-Mailbox | Group-Object -Property:ServerName | Select-Object name,count

Name                                 Count
----                                 -----
esp-br-ex2010                           23
esp-ho-ex2010b                         370

We can also get a count of mailboxes per database in the Exchange organization.

[PS] C:\>Get-Mailbox | Group-Object -Property:Database | Select-Object name,count

Name                                    Count
----                                    -----
MB-BR-01                                   23
MB-HO-01                                  192
MB-HO-02                                  178

As you can see the Group-Object command allows us to see a count of mailboxes based on different attributes or properties of the mailbox. For example a count of mailboxes that are and are not exempt from email address policies.

[PS] C:\>Get-Mailbox | Group-Object -Property:EmailAddressPolicyEnabled | Select-Object name,count

Name                                    Count
----                                    -----
True                                      392
False                                       1

And as a final example, a count of mailboxes by Office (notice that the 6 mailboxes with a null value are still included in the results).

[PS] C:\>Get-Mailbox | Group-Object -Property:Office | Select-Object name,count

Name                                         Count
----                                         -----
Branch Office                                   23
Head Office                                    364

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for


  1. Luis

    Hi Paul,

    I am trying to determine which mailboxes are active in my environment. By active, I mean mailboxes that have sent an e-mail in the last 90 days or perhaps accounts that are active in AD vs disabled.

  2. Chris Lehr

    Hey Paul – fun fact about your “get mailboxes per database” – it won’t return databases with no mailboxes.


  3. Steve

    HI Paul,
    I can see someone already asked about historical data, but their question was not clear enough. Can you think of a way to obtain the number of Exchange boxes for each day of the last few years. I would like to draw a histogram of how that number grew in our Uni.
    Thank you!

    1. Avatar photo
      Paul Cunningham

      Exchange doesn’t keep that historical data for you. You’d need to have collected it yourself over that period of time, either with custom scripts or a reporting tool.

  4. Roberto Leal

    I think I have found a solution sort by lastlogontime export to Excel, Thanks

  5. Roberto Leal

    Hi Paul, How to obtain a list of active mailboxes, us in the DA changed the status of the account to disabled and in exchange we changed the status to not visible

  6. Christian Leber

    This is great, thank you!
    I just have a small problem:
    “Get-Mailbox | Group-Object -Property:ServerName | Select-Object name,count” doesn’t include empty databases into the count.
    Can I somehow do that?

  7. Alemao

    Hi, can I get the number of mailboxes in another month?, for example junuary of 2016

  8. Lars Panzerbjørn

    This is wonderfully useful, and the article came up as the first hit when I googled how to do this exact thing.

    Thanks 😀

  9. Ahmed

    Name Server CurrentMailboxesCount Max

    Avtest KFDCEX25 0
    DB_VIP01 KFDCEX25 14
    DB_VIP02 KFDCEX25 20

    and export to CSV file

  10. Ahmed

    Thank you for your effort, but what if i want to get the server name i can’t figure it out this format:
    Name Server CurrentMailboxesCount Max
    —- —— ——————— —
    Avtest KFDCEX25 0
    DB_VIP01 KFrtttss5 14
    DB_VIP02 KFttttrr5 20

    Please help ..thank u in advance.

    1. Avatar photo
      Paul Cunningham

      Server name attribute on mailboxes is not relevant any more, because mailboxes are homed to databases, not servers.

      To determine the server name you’ll need to do an additional query to match a database to a server. But keep in mind also that databases can be replicated between DAG members, so there may not be just a single server name associated with that database.

  11. sanju

    Paul.. Never mind I figured it out..Used the Group-Object

  12. sanju

    Hi Paul, i cam across this post and was taking some knowledge out of it. I built the below code where I want to gather different values of Custom Attribute 2 and Count them and report them. i made this below taking reference from my previous code that i built on Activation preference found here, “ “.
    Although i can get the output but the CA name has output like below

    CA Name Count

    xxx1,xxx1,xxx1,xxx1,xxx2,xxx2,xxx3 11

    What i really want is

    CA Name Count

    XXX1 6
    XXX2 4

    how can i achieve this. Also i want if there are no values on that Attribute report them with the count as well. below is the code that I worked on. I am looking for answers everywhere but could not. Since I follow your posts rigroulsy i thought best bet is to ask your help…

    #Script Information

    ########################### Add Exchange Shell##############################

    If ((Get-PSSnapin | where {$_.Name -match “Microsoft.Exchange.Management.PowerShell”}) -eq $null)
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn

    ######################### generate the HTML#################################

    function _Drawme {

    $Output =”

    Exhange Audit Report
    Generated $((Get-Date).ToString())

    if($cacount.count -ne 0) {


    $Output+=”#CA NameCA Count”

    foreach ($mbx in $cacount) {




    Write-Output $Output

    #########################Get The Users##################################
    $objprop = @{ user = “”
    caname = “”
    cacount =””

    $users = Get-Mailbox
    ForEach ($user in $users)

    $username = $user.Name
    $caname = $users.CustomAttribute2
    $cacount = $caname.Count

    # Compare the server where the DB is currently active to the server where it should be
    If ($cacount -ne 0)
    $obj = New-Object -TypeName psobject -Property $objprop
    $obj.user = $User.Name
    $obj.caname = $caname.CustomAttribute2
    $obj.cacount = $cacount.count


    if ($cacount.count -ne 0)
    Write-Host “CA Found….Sending Email” -ForegroundColor Red
    $Output= _Drawme

    #Send the Email
    Send-MailMessage -From “” -To “Recipient 1 ” -Subject “Exchange Audit Report” -BodyAsHtml $Output -Priority High -SMTPserver “”
    Write-Host “Nothing Found!!!!!!!!!” -ForegroundColor Green

  13. Paul

    Hello Paul:

    I’m new to Power Shell so please bear with me.

    I am trying to get a count of email addresses (hidden/unhidden) per GAL

    Get-Mailbox | Group-Object -Property:GlobalAddressList -eq “blah blah GAL” | Select-Object Displayname, EmailAddresses, count

    Tried this cmd and got:

    Group-Object : A parameter cannot be found that matches parameter name ‘eq’.
    At line:1 char:53
    + Get-Mailbox | Group-Object -Property:AddressList -eq <<<< "abbotsLEA GAL" |
    Select-Object Displayname, EmailAddresses, count

    Should I use the "contains" variable where I have -eq text?

    Please can you advise.

    1. Avatar photo
      Paul Cunningham

      Group-Object doesn’t work with comparison operators like -eq. If you’re ever in doubt about how a cmdlet works the best resource to start with is the TechNet page for that specific cmdlet.

      In your case perhaps try something more like…

      Get-Mailbox | Where {$_.GlobalAddressList -eq “GALName” -and $_.} | etc etc

  14. Srijith

    Hi Paul,

    How can I get active mailbox list from the exchange 2010 for the last month? Please help.

      1. Himanshu

        Hello Paul,

        Can you please share a command to find out the active mailboxes?

  15. Anees

    Hi Paul,

    I wanted to see mailboxes and Distribution groups in Exchange Database. How can I check this?


  16. Neil


    How do can I list the number of user mailbox bot including resource mailboxes ect… just user mailbox count.

    Thanks! 🙂


  17. will hanger

    very helpful. I’m doing a migration from 2007 to 2013 for a client with 65 mailboxes. I kicked of the mailbox moves about 6 hours ago, and then went out for a few pints of beer with my mates. then i wanted to check on the progress, and remembered seeing this post. the summary tells me i’m about half-way through, so I can enjoy a few more, and tomorrow morning, resume the migration, swing client access, and be done with it. Thanks, Paul!

    [PS] D:>Get-MoveRequest|Get-MoveRequestStatistics|Group-Object -Property StatusDetail|Select-Object name,count|ft -AutoSize

    Name Count
    —- —–
    Queued 22
    CopyingMessages 19
    AutoSuspended 24

  18. Azam

    Hi Paul Cunningham,
    Is there any PS command available to get number of messages sent by a mailbox??


    1. Avatar photo
      Paul Cunningham

      You can gather that type of information using message tracking log searches.

      1. Azam

        Hello Paul Cunningham

        Thanks for your valuable response
        I am using PS command

        $var = get-messagetrackinglog -sender senders_email

        this gives number of message send by a user of mailbox, not the number of message sent by mailbox.
        How can i get the total number of message sent by a mailbox not a user of mailbox


        1. Avatar photo
          Paul Cunningham

          First, be aware that the number of message tracking log entries does not equal the number of unique messages. Each unique message can generate multiple log entries. You’ll need to filter the results down to unique message IDs or pick one event ID to filter on.

          Second, I’m not sure that I understand your scenario. Are you talking about a shared mailbox?

      2. Azam

        Obviously i know that each unique message can generate multiple log entries. I am using filter on Event Id
        as follows
        get-messagetrackinglog -sender senders_email | where-object {$_.EventID -eq “submit”}

        Now come to the point, I have a mailbox named Azam whose primary smtp address is azam@corp.local, it also has a delegate with id neetu@corp.local. I am sending a message using primary smtp address i.e. azam@corp.loca, and also send a message using its delegate’s id i.e. neetu@corp.local. Now there are two messages sent by the mailbox named Azam.
        Now, i wants to know the PS command which returns number of message send by mailbox Azam, and also size of all message sent by this mailbox.

        Kindly reply with PS command

        1. Avatar photo
          Paul Cunningham

          In the log entry for source STOREDRIVER and Event ID RECEIVE there is some extra data that can data that can help differentiate between messages sent by the mailbox owner and messages sent on behalf of.

          The Sender and ReturnPath fields are usually different in that situation.

  19. Alexis Crawford

    Hi Paul,

    when I run (Get-Mailbox -resultsize unlimited).count I get 5141 however when I ran the “Get-MailboxReport.ps1” the result was 2378. So not too sure why the discrepancy in numbers?

    1. Avatar photo
      Paul Cunningham

      Which option are you using when you run the script?

      And do you have more than one domain in your AD forest?

      1. Alexis Crawford

        .get-MailboxReport.ps1 -server ServerName -filename users.csv

        I just copied the script and placed it into a folder

        I did nothing to the script. I ran it as is.

        1 Domain and that’s it.

        1. Avatar photo
          Paul Cunningham

          So with that syntax the script will report only mailboxes on “ServerName”.

          If there are more servers in your org then that would explain the discrepancy.

          To report on all mailboxes in the org you can run “.Get-MailboxReport.ps1 -all”

  20. martinezjrj

    Thanks again Paul! simple and effective.

    However, i keep getting this error when i run this and cant seem to figure it out…

    [PS] C:scripts>.Test-ExchangeServerHealth.ps1 -Reportmode -Sendmail
    Unexpected token ‘Mailbox’ in expression or statement.
    At C:scriptsTest-ExchangeServerHealth.ps1:327 char:19
    + $mbrole = “Mailbox <<<< Server Role"
    + CategoryInfo : ParserError: (Mailbox:String) [], ParseException
    + FullyQualifiedErrorId : UnexpectedToken

    the error refers to the section in the script where variables for the server roles are initialized, here:

    # The server roles must match the role names you see when you run Test-ServiceHealth.
    $casrole = "Client Access Server Role"
    $htrole = "Hub Transport Server Role"
    $mbrole = "Mailbox Server Role"
    $umrole = "Unified Messaging Server Role"

    Thank you


  21. Tim Kuhnell

    Thanks Paul. What if I want to list mailboxes on ie. Exchange2013 ExchangeVersion : 0.20 ( according to Get-mailbox, but Get-Mailbox -ExchangeVersion ’15’ whatever does not Work? We have Exch2010 and 2013

    Br,. Tim

  22. Tim Kuhnell

    Hello Paul,

    I really appreciate your effort here.

    What if I want to count the number of mailboxes in mbx store MBXStore01 ? Can’t figure that out ..

    Br, Tim

  23. C. Wiliams

    Hello Paul: Please help. Our organization has a mixed mail envionment. We migrating from Exchange 2007 to Exchange 2010. We have 3 mailbox servers. We have 6 databases in a DAG. I’m looking for a PS script that can count the mailboxes across all 3 Exchange 2010, and exclude Exchange 2007.

    Can you help?

    Thank you.

  24. Dima

    OK, thank you..
    Just confirming my plan of actions

  25. Dima

    Hi, this counter is the number of mbxs created on that servers? How to find how many users are now using that server? Need to shutdown one of the MB server from DAG for a day, it’s need to move any mbxs from this server to avoid any connections issues?

  26. Madawa

    Really appriciate if you could answer this question.
    I need to know is it possible to get Mailbox Count using WMI query in Exchange 2010? if yes how?

    1. Avatar photo
      Paul Cunningham

      Probably not. I’ve never seen anyone do it that way, thats for sure. Why not just use the PowerShell cmdlets that are built for this purpose? They’re quite easy to use.

  27. Obi

    Paul, hopefully this is not a silly question, but does this count also include detached mailboxes? if so, it there a filter to only include active mailboxes?

  28. Anand

    Simply Cool one… 🙂

  29. Bobby


    I’m getting the following error… Please correct If I’m doing wrong

    [PS] C:Windowssystem32>(Get-Mailbox) .count
    Unexpected token ‘.count’ in expression or statement.
    At line:1 char:21
    + (Get-Mailbox) .count <<<(Get-Mailbox -ResultSize unlimited) .count
    Unexpected token ‘.count’ in expression or statement.
    At line:1 char:43
    + (Get-Mailbox -ResultSize unlimited) .count <<<<
    + CategoryInfo : ParserError: (.count:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

    1. Avatar photo
      Paul Cunningham


      (Get-Mailbox) .count

      Your problem is the space before the .count. There’s not supposed to be a space there 🙂

  30. Kishore Bitra

    Hi Paul,

    It’s nice.

  31. Tunde

    Really simple but very useful.

  32. jacob

    there is an option to count mailboxes with Get-MailboxDatabase -Status syntax ?

  33. Lawrence James

    you can also set your adserversettings to view the enitre forest:

    Set-ADServersettings -ViewEntireForest:$true

  34. Ben

    So how do you handle multiple domains? These commands appear to only return counts of the users in 1 domain.

    1. Avatar photo
      Paul Cunningham

      Hi Ben, adding the -IgnoreDefaultScope switch to the Get-Mailbox cmdlet should do the trick.

Leave a Reply