To use Powershell to list the mailbox databases in Exchange 2007, you should use the get-mailboxdatabase command.
While I was doing some testing with this command, I figured out that get-mailboxdatabase and get-mailboxdatabase ‘Mailbox Database’ both exported different results. Why is this?
In my lab, I have 2 Exchange 2007 servers (DC1 and EX1). One of them is also domain controller (DC1). When I run get-mailboxdatabase on the DC1, I get two results (lines): both the databases, from the DC1 and the EX1. This is what I expected. Because the database names on both servers are the same (let’s say MailDB1), I get two identical database names as a result, but both with a different server name (DC1, and EX1) specified. However: When I run get-mailboxdatabase ‘Mailbox Database’ (in this case MailDB1)I only get one result: the Mailbox Database from the DC1.
Why do I only get one result in the second example? I do specify a Mailbox Database name, which is on both servers the same, right? Shouldn’t I get both Mailbox Databases on both servers as a result in my Powershell console?
The answer is quite simple: If you specify a database name and don’t specify a server name, the search is confined to just the local server. So if you’re running the Powershell command get-mailboxdatabase ‘Mailbox Database’ on the DC1, you will only see the mailbox database of the DC1 in your result.
To dive into the Mailbox Database command, open your Powershell console and type “help get-mailboxdatabase -detailed“. To read more details about the issue described above, read the text for the
“-Identity” parameter.
Thanks for the powershell script it did the trick