Learn Exchange the Guru way !!!


Exchange 2010 Count Mailboxes by Recipient Type

Are you looking to surprise your manager or CIO with a monthly or quarterly Exchange report? When gauging your Exchange environment, sometimes having a simple count of mailboxes, distribution groups, and ActiveSync users can come in handy. In some cases you may want a total of all mailboxes, but if you want a count of User Mailboxes, Room Mailboxes, and Shared Mailboxes separately, look no further, this script will give you just what you need.

$Users = (get-recipient -ResultSize unlimited -ignoredefaultscope -RecipientTypeDetails 'UserMailbox').count
$Shared = (get-recipient -ResultSize unlimited -ignoredefaultscope -RecipientTypeDetails 'SharedMailbox').count
$Room = (get-recipient -ResultSize unlimited -ignoredefaultscope -RecipientTypeDetails 'RoomMailbox').count
$Distro = (Get-DistributionGroup -resultsize unlimited -ignoredefaultscope).count
$AS = (Get-ActiveSyncDevice).count
write-host " "
write-host "==========================="
write-host "| Exchange Object Counter |"
write-host "==========================="
write-host " "
write-host "Total User Mailboxes= $Users"
write-host "Total Shared Mailboxes= $Shared"
write-host "Total Room Mailboxes= $Room"
write-host "Total Distribution Groups = $Distro"
write-host "Total ActiveSync Users= $AS"
write-host " "

Note that the “-ignoredefaultscope” parameter will search across multiple domains and “-RecipientTypeDetails” parameter categorizes the mailboxes by their type. I recommend saving this script as “Get-Totals.ps1”. If you add ActiveSync users into a specific ActiveDirectory security group, you may opt to count the number of members in the AD group rather than counting the number of devices by replacing “$AS = (Get-ActiveSyncDevice).count” with the following:

$AS = Get-Group "ADGroup" | select members
$AS = $AS.members
$AScount = $AS.count

If you use the code above, please be aware that you will be reporting the number of users rather than the number of devices. You can use a combination of both if you wish to report both the number of deices and users, but just be aware that these numbers will likely differ. Some users may have more than one device if your policy permits. If you use the code above, make sure to change the write host for ActiveSync Total to the following:

"write-host "Total ActiveSync Users= $ASCount".

You can also pipe this to an output file and setup an automatic Email report, which you can learn how to do in one of my other posts. Enjoy!

By Doug Spear

One Response to “Exchange 2010 Count Mailboxes by Recipient Type”

  1. Hasan Sayed Says:

    Simple but very useful, we can further categorize per active & inactive users. Also if we are migrating there will be co-existence we need to know on a weekly basis how many mailboxes are residing on legacy and the ones migrated.

Leave a Reply




Do NOT follow this link or you will be banned from the site!