• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
OpenTechTips

OpenTechTips

Comprehensive IT Guides for Pros and Enthusiasts

MENUMENU
  • HOME
  • ALL TOPICS
    • Exchange
    • InfoSec
    • Linux
    • Networking
    • Scripting
      • PowerShell
    • SSL
    • Tools
    • Virtualization
    • Web
    • Windows
  • ABOUT
  • SUBSCRIBE
Home » How to Delete an Exchange Database and demote Exchange Servers

How to Delete an Exchange Database and demote Exchange Servers

June 21, 2020 - by Zsolt Agoston - last edited on January 6, 2021

Removing an Exchange Database is not as simple as clicking on a delete button. Exchange is tied together with Active Directory, a mailbox and other objects have footprints there and if a database is removed that still has any objects in it, that would leave AD in an inconsistent state. We need to make sure to remove any dependencies from AD before proceeding with the removal. That means moving away ALL the mailboxes, from the database, or deleting, disconnecting the mailboxes if they are not needed anymore. Also, if there are ANY kind of move requests associated with the mailbox database, those needs to be removed too. This also applies to completed move requests! After removing the databases from a server, the Exchange server can also be uninstalled. That procedure removes the server from the machine and also from AD.

1. Check databases hosted on the mailbox server that need to be removed

Here we have only DB03 to remove.

PS C:\> Get-MailboxDatabase -Server MB3

Name                           Server          Recovery        ReplicationType
----                           ------          --------        ---------------
DB03                           MB3             False           None


PS C:\>

Trying to do so fails, as we still have mailboxes living in the database. In our example we decided to keep them, so we move all away from the server. We could also remove or disconnect the mailboxes if they don't have any content we need to keep.

How to Delete an Exchange Database and demote Exchange Servers

2. List all the mailboxes in the database

PS C:\> Get-Mailbox -Database DB03

Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
Ashlyn Velazquez          Ashlyn.Velazquez     mb3              Unlimited
Ashtyn Duran              Ashtyn.Duran         mb3              Unlimited
Ayana Bryan               Ayana.Bryan          mb3              Unlimited
Ashton Ortega             Ashton.Ortega        mb3              Unlimited


PS C:\> Get-Mailbox -Database DB03 -Arbitration
PS C:\> Get-Mailbox -Database DB03 -Archive
PS C:\> Get-Mailbox -Database DB03 -PublicFolder
PS C:\> Get-Mailbox -Database DB03 -AuditLog

3. Clear the database

We can either move the mailboxes away from the database or remove them. See examples of both below.

Move mailboxes away from the database

PS C:\> Get-Mailbox -Database DB03 | New-MoveRequest -TargetDatabase DB01 -Priority highest
PS C:\> Get-Mailbox -Database DB03 -Arbitration | New-MoveRequest -TargetDatabase DB01 -Priority highest
PS C:\> Get-Mailbox -Database DB03 -Archive | New-MoveRequest -TargetDatabase DB01 -Priority highest
PS C:\> Get-Mailbox -Database DB03 -PublicFolder | New-MoveRequest -TargetDatabase DB01 -Priority highest
PS C:\> Get-Mailbox -Database DB03 -AuditLog | New-MoveRequest -TargetDatabase DB01 -Priority highest

Remove mailboxes (only non-arbitration mailboxes!)

PS C:\> Get-Mailbox -Server MB3 | Disable-Mailbox
PS C:\> Get-Mailbox -Database DB03 -Arbitration | New-MoveRequest -TargetDatabase DB01 -Priority highest
PS C:\> Get-Mailbox -Database DB03 -Archive | Disable-Mailbox -Archive
PS C:\> Get-Mailbox -Database DB03 -PublicFolder | Disable-Mailbox -PublicFolder
PS C:\> Get-Mailbox -Database DB03 -AuditLog | Disable-Mailbox

4. Check move status

PS C:\> Get-MoveRequest | Get-MoveRequestStatistics
How to Delete an Exchange Database and demote Exchange Servers

5. Remove the Database

Remove moverequests if present:

Get-MoveRequest | ?{$_.Status -eq 'Completed'} | Remove-MoveRequest -Confirm:$false

When done, remove the database:

PS C:\> Remove-MailboxDatabase DB03
How to Delete an Exchange Database and demote Exchange Servers

6. Demote Mailbox Server

If needed, the Exchange deployment can be removed using the MS Programs and Features snapin (appwiz.cpl)

How to Delete an Exchange Database and demote Exchange Servers
How to Delete an Exchange Database and demote Exchange Servers
How to Delete an Exchange Database and demote Exchange Servers

Reader Interactions

Comments Cancel reply

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

Primary Sidebar

Tools

Secondary Sidebar

CONTENTS

  • 1. Check databases hosted on the mailbox server that need to be removed
  • 2. List all the mailboxes in the database
  • 3. Clear the database
  • Move mailboxes away from the database
  • Remove mailboxes (only non-arbitration mailboxes!)
  • 4. Check move status
  • 5. Remove the Database
  • 6. Demote Mailbox Server

  • Terms of Use
  • Disclaimer
  • Privacy Policy
Manage your privacy

To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.

Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.

Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Statistics

Marketing

Features
Always active

Always active
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
Manage options
{title} {title} {title}
Manage your privacy
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Statistics

Marketing

Features
Always active

Always active
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
Manage options
{title} {title} {title}