I had to get the amount of the different types of mailboxes that are available in Exchange.
Exchange 2010 and 2016 in this case.
As I had to execute this as a script I ran into the problem that you have a ‘bare’ powershell and thus first need to connect to Exchange.
For Exchange 2010, note the name of the snapin.
Exchange 2010 – Get Number of all Mailboxes (including +1 for a system mailbox)
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 (get-mailbox -resultsize unlimited).count
Exchange 2010 – Get Number of Equipment Mailboxes
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 Get-mailbox -recipienttypedetails EquipmentMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count
Exchange 2010 – Get Number of Room Mailboxes
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 Get-mailbox -recipienttypedetails RoomMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count
Exchange 2010 – Get Number of Shared Mailboxes
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 Get-mailbox -recipienttypedetails SharedMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count
Exchange 2010 – Get Number of User Mailboxes
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 Get-mailbox -recipienttypedetails UserMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count
For Exchange 2016, note the name of the snapin. The actual powershell commands to receive the info are the same as with Exchange 2010.
Exchange 2016 – Get Number of all Mailboxes (including +1 for a system mailbox)
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin (get-mailbox -resultsize unlimited).count
Exchange 2016 – Get Number of Equipment Mailboxes
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin Get-mailbox -recipienttypedetails EquipmentMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count
Exchange 2016 – Get Number of Room Mailboxes
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin Get-mailbox -recipienttypedetails RoomMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count
Exchange 2016 – Get Number of Shared Mailboxes
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin Get-mailbox -recipienttypedetails SharedMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count
Exchange 2016 – Get Number of User Mailboxes
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Snapin Get-mailbox -recipienttypedetails UserMailbox -resultsize unlimited | Measure-Object | Select-Object -expand Count
Hope this helps you!
Cheers!