When you are running an Exchange 2013 database availability group in your environment you may have a need to remove one of the servers from the DAG, for example during decommissioning of server hardware.

If you were to try and simply uninstall Exchange 2013 from the server you would encounter an error during the readiness checks.

exchange-2013-remove-dag-member-01

This computer is a member of a database availability group (DAG). It must be removed from the DAG before you can uninstall Exchange.

Following that advice if you were to try and remove the server from the DAG you may encounter this error.

exchange-2013-remove-dag-member-02

Mailbox server ‘E15MB3’ cannot be removed from the database availability group because mailbox database ‘Mailbox Database 1’ has multiple copies. Use Remove-MailboxDatabaseCopy either to remove the copy from this server or to remove the copies from other servers in the database availability group.

By now I’m sure you realise that there is a process that needs to be followed before you can uninstall Exchange 2013 from the DAG member.

  1. Removing database copies
  2. Removing the Exchange server from the DAG

Let’s take a look at those steps in more detail.

Removing Database Copies

The first part of the process is the removal of database copies. There are actually two approaches here.

  1. If you are planning to remove the server from the DAG but keep it as a standalone server hosting databases, then any copies of those databases must be removed from other DAG members first.
  2. If you are planning to completely uninstall Exchange 2013 from the server then any database copies should be removed from the server that is being uninstalled.

Technically you could use the first approach even if you plan to completely uninstall the server, but even after removing the server from the DAG you won’t be able to uninstall Exchange 2013 if it still hosts databases that contain mailboxes.

See Exchange 2013 Database Removal Error: “This mailbox database contains one or more mailboxes” for more information.

So it makes sense to use the second approach for a server that is being completely decommissioned, which is the scenario I will be using for the rest of this tutorial.

In the Exchange Admin Center navigate to Servers -> Databases and select a database that has a copy on the server you are removing from the DAG.

exchange-2013-remove-dag-member-03

If it happens to be the active database copy you would see an error and you must first switchover the database to another DAG member.

The database “Mailbox Database 3” is currently hosted on server “E15MB3”. Use Move-ActiveMailboxDatabase to move the active copy of the database to a different server.

Click the Remove link for the database copy.

exchange-2013-remove-dag-member-04

If you have multiple database copies to remove you can use this PowerShell command to remove them all. Again, this command won’t work if the database copy is active or if it is the only copy of the database.

[PS] C:\>Get-MailboxDatabaseCopyStatus -Server E15MB3 | Remove-MailboxDatabaseCopy

Removing the Server from the Database Availability Group

After removing all database copies from the DAG member the next step is to remove it from the DAG itself.

In the Exchange Admin Center navigate to Servers -> Database Availability Groups. Select the DAG and click the Manage DAG Membership button.

exchange-2013-remove-dag-member-05

Highlight the server name and click the Remove button.

exchange-2013-remove-dag-member-06

Click Save to complete the removal process.

You can also remove the DAG member using PowerShell.

[PS] C:\>Remove-DatabaseAvailabilityGroupServer -Identity E15DAG -MailboxServer E15MB3

Removing Exchange Server 2013

Now that the Mailbox server has no databases and has been removed from the DAG, and assuming the server performs no other roles in your organization, you can uninstall Exchange 2013.

exchange-2013-remove-dag-member-07

[adrotate banner=”49″]

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Eric West

    I have 4 Ex 2013 servers. Two database in a DAG and two cas. We’ve migrated to O365 but will be keeping a hybrid configuration to allow devices (printes, server alerts, etc) to send email. Can I remove one server from the DAG, uninstall ex2013 from database server B and CAS server B. Add the CAS role to database server A and uninstall exchange from CAS server A?

  2. Mark

    Would this process still be valid for a two server Exchange 2019 DAG?

  3. Brian

    Hi Paul. It’s amazing this article is still paying off for readers so many years later. I have a question – we have/had a 2 Exchange server + Witness server setup. We have migrated all user email/mailflow to a cloud provider and no longer need the exchange servers at all. Time to remove them. I followed your instructions and have removed one of the Exchange servers from the DAG cleanly.

    So now I am left with 1 Exchange server hosting all the databases and the Witness server. I don’t need to use these servers for anything else and will power them off when completed.

    – Do I uninstall exchange through add/remove programs on the ‘removed from the DAG’ server yet? Or do I need to wait until my last server is also ready for uninstall? Or do I need to do that at all? I’m worried of confusing the domain if I uninstall exchange from one while other still has active DBs.

    – OR do I remove the last server from the DAG and delete the DAG before I work through the procedure of full on prem exchange uninstall? And do I do the uninstall on one or both exchange servers?

  4. Janan

    Hi Paul

    I need your suggestion on our exchange 2013 environment.
    We are running Exchange 2013 SP1 version 15.0.847.4030 CU9 and planning to upgrade it to latest CU 23 .
    Our environment is a standalone single exchange server, not DAG.
    Can you help on a solid steps to avoid any unforeseen issues during the upgrade process to CU 23.

    1. Fabio Martins

      Hi! I don´t have the steps, but you have an upgrade path once you have to obey .Net framework requirements. I am afraid of that you will have difficult in finding the cummulative updates do download from microsoft website.

  5. Mohammed

    I have 4 exchange server all are in dag with running exchange 2013, one of server on different site on active directory site (DR), witness server role on another server at primary site . on the DR site also we have domain controller. currently we are in the hybird we have been moved all our the neccesary mailboxes to o365 . now we wants to discard few servers slowly , firslty wants to start with DR server . any impact .

  6. Harm

    Hi Paul, thanks for the great information.
    We are moving away from dag members. we only have 2 mail servers in the same site that are members of one dag group.
    when i do all things above , make databases active on the exchange that we are trying to keep as standalone exchange , removing databases on the exchange we are going to uninstall and finnally uninstall the exchange server, are there any additionall steps required to uninstall or delete the file replication setup , like second network card setup or ecp settings that needs to be removed or is exchange seeing with uninstalling that it is the last dagmember and will all setting removed automaticly?

  7. Rick

    Thanks for this! It was very helpful in decommissioning a 2016 DAG member.

  8. Alex

    I had 4 Exchange server in DAG.
    I don’t have Exchange server anymore (Don’t ask how it’s happened)
    Now i run setup with key -RecoverServer but I get error:
    The Exchange server is a member of a database availability group.
    How remove member of DAG with using ADSIEdit?

  9. Srinivas

    Hi Paul,

    We have 4 Exch 2010 servers in DAG with 1+3 copies of Database. We want to remove two servers from the 4 Node DAG and keep 1+1 copy of database. File share witness is on the HUB/CAS server. Will it be a straight forward steps to remove databases first and then delete the nodes from using Manage DAG Membership and then uninstall the servers. Suggestion appreciated.

    Thanks
    Sri

  10. Augsuto

    Hi,
    I have the problem, exchange doesn’t can be removed, my Witness server and one member from DAG have problems on Hardware (i can’t power on), i need to change the witness server and remove the DAG member.

    I can’t remove the DAG member, because it can’t contact the Witness server for removal, and i cant change the Witness server.

    I need to up two different servers and point as the same name? After this, remove those servers from DAG ?

    Thanks

  11. Tarig Mustafa

    Dear I did start the Domain controller
    and their is issue with service :
    MSExchangeEdgeSync , MSExchangeFrontEndTransport , MSExchangeMailboxReplication , MSExchangeDelivery , MSExchangeSubmission , MSExchangeRepl , MSExchangeRPC , MSExchangeFastSearch , MSExchangeThrottling , MSExchangeTransport .
    all this service not able to start even after run this command in power shell
    Get-Service *exchange* | Start-Service
    if I try to open exchange management shell it open but connect to other active member on dag

    I really appreciate your helpful support

    1. Tarig Mustafa

      In EAC this server DRex01 status is unknown if I open details it says service down and on error message section :
      A server-side administrative operation has failed. The Microsoft Exchange Replication service may not be running on server Drex01.domain.com . Specific RPC error message: Error 0x6d9 (There are no more endpoints available from the endpoint mapper) from RpccGetCopyStatusEx4

        1. Tarig Mustafa

          Thanks Paul
          if I can find any way to remove it form dag and rejoin it
          the database in that server is out of date so their is no harm to remove it
          from EAC their is no option to remove it

          I really appreciate your helpful support

          1. Avatar photo

            I don’t actually understand what you’re saying there.

            I can only give you general advice here. I can’t see your environment or the errors that you’re experiencing, so if you can’t describe them clearly then I can’t help you very much.

            If you’re not able to work out a solution to your problem you should open a support case with Microsoft.

  12. Tarig Mustafa

    Dear Paul
    Thank you for this tutorial
    I have 3 member on dag all run exchange 2013, one of server on different site on active directory site, on that site also we have domain controller but it off, the problem on that site is exchange service like replication services won’t running so I have on eac on database bad copy, if I plane to fix it should I remove it from dag and rejoining it again?
    Thanks

  13. paul williams

    What if server is also CAS? Is there any way to keep the message tracking logs that would otherwise be lost?

  14. paul williams

    If exchange is uninstalled properly off the decomm server is there any need to remove anything from ADSI afterwards?

  15. Trent

    Fantastic walk-through! Thank you for putting these together Paul, always incredibly helpful!

    Quick question, if you have a second. Have you ever seen the issue when trying to remove a server from a DAG that the server must be running exchange? Exchange is definitely installed on the server, so I’m not sure what the deal is. I have managed to get both database copies deleted

    1. TheWienerman

      Apologies for barging in..probably in the wrong place.
      We are moving mailboxes to O365 from Exchange 2010 on prem but will remain Hybrid. Now that we have vacated many onprem servers, we have some empty DAGs and are ready to decom. Are there no concerns about removing DAGs in an existing Exchange 2010 environment? I see all the instructions and they seem straight-forward but I need to remove 4 dags from a 6 dag environment and dont see any red flags. Seems too good to be true.

        1. TheWienerman

          Great. What is the best way to ensure My DAGs are really ready to be decom’ed? Powershell? EMC? Most of the articles I found are for Ex2013 and we are running Ex2010.

          1. TheWienerman

            The first DAG removal went well. Only catch was that I needed to turn off the damn DAM 😉

            Set-DatabaseAvailabilityGroup -Identity MyDAG01 -DatacenterActivationMode Off

            Then it went swimmingly.
            Thanks Paul!

  16. Shahan

    Hi,

    How I can resolved mention issue,

    Passive Healthy
    Copy queue length: 0
    Content index state: Unknown
    Suspend | Activate | Remove
    View details

    I create a dag and when above database is copying from One Exchange server to another so it stuck and content index state is unknown. Please tell me how I can resolve this issue.

    Thanks.

  17. Rahamathullah

    And also how to remove issued SSL certificate.

  18. Rahamathullah

    I want to uninstall one of my DAG member server. it has mailbox/ CAS role on it. above steps should be followed for the same.

  19. Hein Traag

    We were almost ready with setting up our new Exchange 2013 servers when we did a fubar action and one of us decided to delete the newly created servers and start installing from scratch. We now stil see the ‘old’ new exchange 2013 servers and dag group. Next to the 2010 servers and the ‘new’ 2013 servers and dag group.

    The failed 2013 servers are not there anymore.. how do we remove them from the list in the ECP? If you have any ideas on that we would love to know about it.

    Thanks
    Hein

      1. Hein

        Thanks Paul for the answer.

        Just to make sure i understand correctly.. we install two new servers with the exact same names as the old servers. Install Exchange on them and them do a clean uninstall?

        If that is it then we should be done in no time at all.

        Thanks for the answer and thanks for a truly helpfull website.

        1. Hein Traag

          Great. Will do just that then. Thanks for the info.

          Adding this to try and recover the migration mailbox. Apparently after installing the two new servers my now ex-colleague had removed the mailbox database on server 2. Which results in not being able to migrate mailboxes using the ECP.

          Manual commandline migration does work. Any idea on how to restore a migration mailbox so we can batch migrate using ECP?

  20. Jonby

    Just want to say thank you. This “How To” made me more comfortable when I decommission one of our server out of the DAG last night. We actually have Exchange 2010 but same steps. Very detailed and easy. Thanks again.

Leave a Reply