Count active mailboxes and distribution groups in Exchange

Exchange Management Shell one-liners that count the active user mailboxes, shared mailboxes and distribution groups in an Exchange 2016 organisation.

Contents

Knowing how many mailboxes are actually in use helps with monitoring an Exchange environment and with capacity planning. These commands, run in the Exchange Management Shell of an Exchange 2016 organisation, give you the numbers.

Active user mailboxes

(Get-Mailbox -ResultSize Unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox') -and (IsMailboxEnabled -eq $True)}).Count

How it works:

  1. Get-Mailbox returns mailboxes in the organisation.
  2. -ResultSize Unlimited returns all of them instead of the first 1,000.
  3. -Filter {…} keeps only mailboxes whose RecipientTypeDetails is UserMailbox and that are enabled. -eq compares a property with a value.
  4. .Count gives the number of mailboxes that match.

Active shared mailboxes

The same filter with a different recipient type:

(Get-Mailbox -ResultSize Unlimited -Filter {(RecipientTypeDetails -eq 'SharedMailbox') -and (IsMailboxEnabled -eq $True)}).Count

Distribution groups

(Get-DistributionGroup -ResultSize Unlimited).Count

Without -ResultSize Unlimited, this command also stops at 1,000 results.

Microsoft’s reference pages for Get-Mailbox and Get-DistributionGroup list the other properties you can filter on.

Join the discussion

Comments are hosted on comments.vciso.ch, a server I run myself. Nothing is loaded from it until you press the button below. Loading comments connects your browser to that server, and signing in with GitHub sets a cookie there. See the privacy page for details.

Type to search.

↑ ↓ to move, Enter to open, Esc to close