I wanted to mount All mailbox databases from all servers that had them. This was a scenario where I had servers recovered with no DB files. I did not need them, I was going to start with empty databases. The command was going to be simple:

Get-MailboxDatabase | Mount-Database -Confirm:$false

Except that this command had a major flaw. Can you guess?

When you run the command above, it will get all mailbox databases and try to mount them. As I described earlier, DB files do not exist so Exchange will create new files. You would assume that –Confirm:$false will fly by confirmation prompts and you will have all DBs mounted when you return from your coffee run… WRONG.

When you return from coffee run, the EMS will be waiting for your input!!! How did that happen? Why did –confirm not work? It did. The prompt you have is not for confirming the operation of mounting the database. The prompt is for you to confirm that it is ok to create new empty DB files. This is crucial. If you accidentally mount DB when you meant to restore from backup, it could spell a disaster (wasn’t it enough that you were dealing with one already?).

Now, if you are sure that this is what you want to do and start with new empty DBs, you can do the following:

Get-MailboxDatabase | Mount-Database –Confirm:$false –Force

Note the “–Force”. Now you are telling Exchange to shut up and do what you asked it to do. You should now feel superior to that stupid computer who only does what you tell it to do.. or does it?

Ref: You can read more about Mount-Database syntax and parameters here.

Quote of the day:

A man’s errors are his portals of discovery. – James Joyce