I was doing an AD forest restore (blog will follow soon) – and was trying to do some metadata cleanup. The process I was giving me an error:
DsRemoveDsDomainW error 0X2015(The directory service can perform the requested operation only on a leaf object.)
Please note that the “domain management” command is for Server 2003 and was since replaced with “partition management”.
To resolve this issue, follow these steps:
- Click Start, click Run, type ntdsutil, and then press ENTER.
- At the Ntdsutil command prompt, type partition management, and then press ENTER.
- Type connections, and then press ENTER.
- Type connect to server Domain_Controller_Name, and then press ENTER.
- After the following message appears, type quit, and then press ENTER:
- At the domain management prompt, type list, and then press ENTER.
- Note the following entry:
For example, if the child domain is Contoso.com, note the following entry:DC=DomainDnsZones,DC=contoso,DC=com
- Type the following command, and then press ENTER.
delete nc dc=domaindnszones,dc=Child_Domain,dc=extension
Note In this command, Child_Domain represents the name of the child domain that you want to remove. For example, if the child domain is Contoso.com, type the following command, and then press ENTER:delete nc dc=domaindnszones,dc=contoso,dc=com
- Quit Ntdsutil.
This helped me to remove domains which I no longer needed.