Skip to content

Dismount database Exchange with PowerShell

You want to dismount a database in Exchange with PowerShell. Or you like to dismount all the databases on a particular Exchange Server. In this article, you will learn how to dismount a database in Exchange with PowerShell. Do you like to know how to mount a database? Read the article mount database in Exchange with Powershell.

Status mailbox database mounted

Let’s see the mounted status of the databases. Run Exchange Management Shell as administrator. Run the following command.

[PS] C:\>Get-MailboxDatabase -Status | Sort Name | Format-Table Name, Server, Mounted

Name Server Mounted
---- ------ -------
DB01 EX01      True
DB02 EX01      True
DB03 EX01      True
DB04 EX01      True
DB05 EX01      True

We have five databases on the Exchange Server. The Mounted status is showing True on the databases. This means that the databases are mounted.

Dismount mailbox database Exchange

Dismount single database. We are going to dismount the database DB01 and check the mounted status. We will add the switch -Confirm:$False at the end of the command. This will not give us a warning if we are sure to dismount the database on the Exchange Server.

[PS] C:\>Dismount-Database "DB01" -Confirm:$False

[PS] C:\>Get-MailboxDatabase -Status | Sort Name | Format-Table Name, Server, Mounted

Name Server Mounted
---- ------ -------
DB01 EX01     False
DB02 EX01      True
DB03 EX01      True
DB04 EX01      True
DB05 EX01      True

DB01 is showing the Mounted state as False. This means that the database DB01 is in a dismounted state. Great!

Dismount multiple mailbox databases Exchange

What if you have a lot of databases on an Exchange Server and you like to dismount them? You don’t want to run the command one by one and changing the Identity of the database to another name. We are going to dismount all the databases on the Exchange Server EX01. Add the switch -Confirm:$False on the end of the command. After that, we are going to check the database mounted status.

[PS] C:\>Get-MailboxDatabase -Server "EX01" | Dismount-Database -Confirm:$False

[PS] C:\>Get-MailboxDatabase -Status | Sort Name | Format-Table Name, Server, Mounted

Name Server Mounted
---- ------ -------
DB01 EX01     False
DB02 EX01     False
DB03 EX01     False
DB04 EX01     False
DB05 EX01     False

All the databases on Exchange Server EX01 are showing as False. This means that the databases are in a dismounted state.

Conclusion

You learned how to dismount a database in Exchange with PowerShell. You also learned how to dismount all the databases on a particular Exchange Server. Make use of the -Confirm:$False switch. I hope that this article was informative to you. Did you enjoy this article? You may like Monitor Exchange database index state crawling. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *