You can retrieve all kinds of information about a mailbox database using the Exchange Management Shell cmdlets. Surprisingly, the total number of mailboxes in a given mailbox database is not one of those pieces of information. We need to retrieve this data manually. Luckily, PowerShell makes this easy, as you will see in this recipe.
Let's see how to find the total number of mailboxes in a database using the following steps:
Countproperty of a collection of mailboxes:
@(Get-Mailbox -Database DB1).count