Tuesday, September 11, 2007

Using the Powershell to check for mounted mailbox databases

If you want to quickly check to see what mailbox databases are mounted (or not mounted) there is a simple command that you can run from the Exchange Management Shell.

Get-Mailboxdatabase -status | where {$_.Mounted -eq $true}

To see what mailboxdatabaes are not mounted you can do:
Get-Mailboxdatabase -status | where {$_.Mounted -eq $false}

Let's break down what is going on here.
Get-MailboxDatabase will generally just return the list of mailbox databases in the organization.
The -Status switch will tell the command to get the status (Mounted, Last Full backup, et cetera).
We then pipe this into the where command to do the searching. The variable we are looking for here is Mounted and we need it to be equal (-eq) to True ($true).

No comments: