So say for some reason you want to remove a Domain from Active Directory that no longer exists… how do you do it?
As always with Metadata Cleanups NTDSUTIL is your friend.
To remove the domain you need to remove the following using NTDSUTIL:
All Domain Controllers for the domain you want to remove.
All Naming Contexts for the Domain you want to remove.
You can then remove the actual Domain itself. Its important to remember when removing the naming contexts that there will be more than one. So for example:
DC=DomainDnsZones,DC=domain,DC=net Its the DNS Zone that people tend to forget !!
If you get an error about Leaf Objects you havent removed all the Naming Contexts. You also need to ensure you are connected to the Domain Naming Master to perform the actual Domain Removal.
Please ensure you are 100% certain you want to do the below, and dont do in a production environment without testing first
Below are some screenshots and bullet points on the end to end process:
With NTDSUTIL all of the commands can be abbreviated as long as they are unique, I have put some in brackets next to the full command.
First of all Connect to the Domain Naming Master
Connect using NTDSUTIL 1. Start up NTDSUTIL from a command prompt Go into the Metadata Cleanup (M C for short) 2. Metadata Cleanup Go into connections 3. Connections Connect to the Domain Naming FSMO holder for your forest 4. Connect to <Server>
First of all remove any Domain Controllers from the Domain you wish to remove.
Quit Connections (Q) 1. Quit Select the object you want to remove by using Select Operations Target ( S O T for short) 2. Select Operations Target List the Domains in your Forest 3. List Domains Connect to Domain you wish to remove 4. Select Domain <number> List the Sites in your Forest and Select the Site which contains the first (or only) domain controller you wish to remove 5. Select Site <number>
List Domain Controllers in the site you connected to above
1. List Servers in Site Select Domain Controller you want to remove 2. Select Server <number>
You are ready to remove the Domain Controllers
1. Quit Remove the Domain Controller 2. Remove Selected Server 3. Select Yes on the pop up window
4. Select Yes on the pop up windows
5. You will get back a message saying the Domain Controller has been removed.
Then you need to remove the naming contexts for the Domain you wish to remove.
Move back to the objects you can select to select the Naming Context you want to remove
1. S O T List the naming contexts for your Forest 2. List Naming Contexts Select the Naming Context you wish to remove 3. Select Naming Context <number>
Then quit back to remove the Naming Context
1. Quit 2. Remove Selected Naming Context 3. Select yes to remove the naming Context
4. You will get back a message saying the Naming Context has been removed.
Repeat the above steps for all Domain Controllers and Naming Contexts for the Domain you wish to remove.
Next you need to remove the Domain itself !!PLEASE TAKE NOTE OF THE MESSAGE !!!
1. Remove Selected Domain
And thats it .. should be all gone..
本文采用 知识共享署名 4.0 国际许可协议（CC-BY 4.0）进行许可。转载请注明来源： https://snowfrs.com/2020/06/20/remove-a-domain-using-NTDSUTIL.html 欢迎对文中引用进行考证，欢迎指出任何不准确和模糊之处。