Get number of mailboxes in each database?

Many times we need to find number of mailboxes in each database and the size of the database (EDB file) of all servers in an Exchange 2010 environment. With PowerShell, it is fairly simple to grab in a single line.

Get-MailboxDatabase | Select Server, StorageGroupName, Name, 
@{Name="Number Of Mailboxes";expression={(Get-Mailbox -Database 
$_.Identity | Measure-Object).Count}} | Format-Table -AutoSize

Export to CSV:

Get-MailboxDatabase | Select Server, StorageGroupName, Name, 
@{Name="Number Of Mailboxes";expression={(Get-Mailbox -Database 
$_.Identity | Measure-Object).Count}} | Export-Csv C:\ServerStat-1.csv

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.