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 393
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 393
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
6
Head Office 364




So how do you handle multiple domains? These commands appear to only return counts of the users in 1 domain.
Hi Ben, adding the -IgnoreDefaultScope switch to the Get-Mailbox cmdlet should do the trick.
you can also set your adserversettings to view the enitre forest:
Set-ADServersettings -ViewEntireForest:$true
there is an option to count mailboxes with Get-MailboxDatabase -Status syntax ?
Is that a question or a statement?
Really simple but very useful.
Hi Paul,
It’s nice.
Paul
I’m getting the following error… Please correct If I’m doing wrong
[PS] C:\Windows\system32>(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
Mine:
(Get-Mailbox).count
Yours:
(Get-Mailbox) .count
Your problem is the space before the .count. There’s not supposed to be a space there
Simply Cool one…
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?
I don’t think so.
Paul,
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?
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.