Quick Tip: View the database size and mailbox count for mailbox databases

In this quick tip post I will show you how to retrieve mailbox database size and mailbox count for one or all mailboxes. Lets start with mailbox database size.

Mailbox database size

This command is quite simple and utilizes the –Status parameter in the Get-MailboxDatabase cmdlet:

Get-MailboxDatabase –Identity <MailboxDatabaseName> -Status | Select ServerName,Name,DatabaseSize

To retrieve the size of all mailbox databases:

Get-MailboxDatabase -Status | Select ServerName,Name,DatabaseSize

And if you want to sort this on DatabaseSize:

Get-MailboxDatabase -Status | Select ServerName,Name,DatabaseSize | Sort-Object DatabaseSize –Descending

And with sorting on the mailbox database name:

Get-MailboxDatabase -Status | Select ServerName,Name,DatabaseSize | Sort-Object Name –Descending

Mailbox count for mailbox databases

Now we will focus on counting mailbox databases. This command is also quite easy to use.

Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count –Descending

Let’s break this up a bit… The first part is a ordinary Get-Mailbox cmdlet with -ResultSize:Unlimited to include all mailboxes:

Get-Mailbox -ResultSize:Unlimited

Then we group the objects from the result of the Get-Mailbox cmdlet on Database to be able to count based on each mailbox database:

Group-Object -Property:Database

Moving on with a selection of the properties we want to display including a count:

Select-Object Name,Count

And finally we sort the results based on the count property to get it in a nice list with the mailbox database with most mailboxes on top:

Sort-Object -Property:Count -Descending

Advertisements

Show and move “hidden” Arbitration mailboxes in Exchange Server 2010

So, let’s say you have a new installation of Exchange Server and you want to move all mailboxes, including Arbitration, from the default database created during the installation to a new mailbox database. Here is how to do it…
 
First of all, if you just try to delete the default database you will get this message:
 
DatabaseRemoveError
 
Stating that the database isn’t empty, even though it does look empty if you do a get-mailbox for the specific database:
get-mailbox -Database “Mailbox Database 1905367170”
 
DatabaseRemoveError2
 
There is a switch that you should use if you want to see all mailboxes, even the “hidden” Arbitration mailboxes:
get-mailbox -Database “Mailbox Database 1905367170” –Arbitration
 
This gives us different result then the first get-mailbox command:
 
DatabaseRemoveError3
 
As you can se the database isn’t as empty as we first thought. To move these mailboxes to the new database you can easily pipe the result of the get-mailbox command and create new move requests for all Arbitration mailboxes:
get-mailbox -Database “Mailbox Database 1905367170” -Arbitration | New-MoveRequest –TargetDatabase “MailboxDatabase1”
 
DatabaseRemoveError4
 
So, good luck with the moves and please let me know if you bump in to any problems, thanks for reading!