Monday, August 29, 2011

How to mount/dismount mailbox databases via PowerShell

For several times I had to dismount and re-mount all the mailbox databases from a server, and doing this via Exchange Management Console is way to slow, so I've researched a bit and found some commands to do this with PowerShell.

How to check Exchange databases status via PowerShell

In order to mount/dismount DBs, use Mount-Database and Dismount-Database respectively. Use Get-MailboxDatabase cmdlet with -Server parameter to fetch the DBs from a server and then the mount/dismount cmdlet.

Dismount a single DB
Dismount-Database -Identity DBNAME -Confirm:$False

Dismount all DBs of a server
Get-MailboxDatabase -Server SERVERNAME | Dismount-Database -Confirm:$False

Mount a single DB
Mount-Database -Identity DBNAME -Confirm:$False

Mount all DBs of a server
Get-MailboxDatabase -Server SERVERNAME | Mount-Database -Confirm:$False

2 comments:

  1. I Felipe, it's a nice set of commands, but i think you got a typo, where it reads "Mount a single DB : Dismont-database..."

    It should read "Mount a single DB: Mount-Database..."

    ReplyDelete
    Replies
    1. Hi LxFlip, thanks for the note!

      I've been away from the blog, but just fixed it.

      Thanks again!

      Delete

Related Posts Plugin for WordPress, Blogger...