Delete Failed DC from Active Directory
When you try to remove a domain controller from your Active Directory domain by using Dcpromo.exe and fail, or when you began to promote a member server to be a Domain Controller and failed (the reasons for your failure are not important for the scope of this article), you will be left with remains of the DCs object in the Active Directory. As part of a successful demotion process, the Dcpromo wizard removes the configuration data for the domain controller from Active Directory, but as noted above, a failed Dcpromo attempt might leave these objects in place.
The effects of leaving such remains inside the Active Directory may vary, but one thing is sure: Whenever you’ll try to re-install the server with the same computername and try to promote it to become a Domain Controller, you will fail because the Dcpromo process will still find the old object and therefore will refuse to re-create the objects for the new-old server.
In the event that the NTDS Settings object is not removed correctly you can use the Ntdsutil.exe utility to manually remove the NTDS Settings object.
If you give the new domain controller the same name as the failed computer, then you need perform only the first procedure to clean up metadata, which removes the NTDS Settings object of the failed domain controller. If you will give the new domain controller a different name, then you need to perform all three procedures: clean up metadata, remove the failed server object from the site, and remove the computer object from the domain controllers container.
You will need the following tool: Ntdsutil.exe, Active Directory Sites and Services, Active Directory Users and Computers.
Also, make sure that you use an account that is a member of the Enterprise Admins universal group.
Caution: Using the Ntdsutil utility incorrectly may result in partial or complete loss of Active Directory functionality.
To clean up metadata
- At the command line, type Ntdsutil and press ENTER.
- At the Ntdsutil: prompt, type metadata cleanup and press Enter.
- At the metadata cleanup: prompt, type connections and press Enter.
- At the server connections: prompt, type connect to server <servername>, where <servername> is the domain controller (any functional domain controller in the same domain) from which you plan to clean up the metadata of the failed domain controller. Press Enter.
- Type quit and press Enter to return you to the metadata cleanup: prompt.
- Type select operation target and press Enter.
- Type list domains and press Enter. This lists all domains in the forest with a number associated with each.
- Type select domain <number>, where <number> is the number corresponding to the domain in which the failed server was located. Press Enter.
- Type list sites and press Enter.
- Type select site <number>, where <number> refers to the number of the site in which the domain controller was a member. Press Enter.
- Type list servers in site and press Enter. This will list all servers in that site with a corresponding number.
- Type select server <number> and press Enter, where <number> refers to the domain controller to be removed.
- Type quit and press Enter. The Metadata cleanup menu is displayed.
- Type remove selected server and press Enter.
You will receive a warning message. Read it, and if you agree, press Yes.
At this point, Active Directory confirms that the domain controller was removed successfully. If you receive an error that the object could not be found, Active Directory might have already removed from the domain controller.