Q. How can I avoid receiving an 0x2015 error when I use Ntdsutil to delete a nonexistent domain?

John Savill

May 2, 2004

3 Min Read
ITPro Today logo in a gray background | ITPro Today

A. If you have a child domain that no longer exists and has no servers, you can use Ntdsutil's Active Directory (AD) metadata cleanup capability to delete the domain. However, when you use metadata cleanup, you might receive the error "metadata cleanup: remove selected domain DsRemoveDsDomainW error 0x2015 (The directory service can perform the requested operation only on a leaf object.)" The error means that the domain still contains information (usually a domain DNS zone). You can check the domain and resolve the problem as follows:

  1. Start Ntdsutil (click Start, Run; enter cmd.exe; then enter ntdsutil.exe.

  2. Switch to domain management mode by entering the domain management argument at the ntdsutil prompt:

    ntdsutil: domain management
  3. Select the server to use by invoking the Connections submenu, then connect to a domain controller (DC) by entering the connections argument at the domain management prompt:

    domain management: connections

    You'll see the message "Connected to omega using credentials of locally logged on user."

  4. Type the following at the server connections prompt:

    server connections: connect to server omega

    The following messages will appear. (The text that's enclosed in quotes represents messages that are displayed after you type the indicated commands.)

    "Disconnecting from omega...Binding to omega...Connected to omega using credentials of locally logged on user."
  5. Exit the server connections area by entering the quit argument at the server connections prompt:

    server connections: quit
  6. List the naming contexts (NCs) by entering the list argument at the domain management prompt:

    domain management: list

    (Directory partition names that contain International Unicode characters will display correctly only if the appropriate fonts and language support are loaded.) You'll then see the NCs, as in the following example:

    "Found 7 Naming Context(s)0 - CN=Configuration,DC=savilltech,DC=com1 - DC=savilltech,DC=com2 - CN=Schema,CN=Configuration,DC=savilltech,DC=com3 - DC=DomainDnsZones,DC=savilltech,DC=com4 - DC=ForestDnsZones,DC=savilltech,DC=com5 - DC=child1,DC=savilltech,DC=com6 - DC=DomainDnsZones,DC=child1,DC=savilltech,DC=com"
  7. In this example, I'm trying to delete DC=child1,DC=savilltech,DC=com. However, because DC=DomainDnsZones,DC=child1,DC=savilltech,DC=com exists under DC=child1,DC=savilltech,DC=com, I can't delete DC=child1,DC=savilltech,DC=com until I remove DomainDnsZones under child1. To do so, I type the delete argument at the domain management prompt as follows:

    domain management: delete NC DC=DomainDnsZones,DC=child1,DC=savilltech,dc=com

    After removing the DNS NC from the child domain, you'll see the following message:

    "The operation was successful. The partition has been marked for removal from the enterprise. It will be removed over time in the background."

    Don't create another partition with the same name until the servers that hold this partition have had an opportunity to remove it. Removal is complete when knowledge of the deletion of the partition replicates throughout the forest and the servers that hold the partition have removed all objects within it. You can verify that the partition has been completely removed by consulting the Directory event log on each server.

  8. End the domain management command by entering the quit argument at the domain management prompt:

    domain management: quit

    You can now use Ntdsutil to remove the domain in the usual way, as in the following example.

    ntdsutil: metadata cleanupmetadata cleanup: connections"Connected to omega using credentials of locally logged on user."server connections: connect to server omega"Disconnecting from omega...Binding to omega ...Connected to omega using credentials of locally logged on user."server connections: quitmetadata cleanup: select operation targetselect operation target: list domains"Found 2 domain(s)0 - DC=savilltech,DC=com1 - DC=child1,DC=savilltech,DC=com"select operation target: select domain 1"No current siteDomain - DC=child1,DC=savilltech,DC=comNo current serverNo current Naming Context"select operation target: quitmetadata cleanup: remove selected domain"'DC=child1,DC=savilltech,DC=com' removed from server 'omega'"metadata cleanup: quitntdsutil: quit"Disconnecting from omega...Gone!"

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like