Subscribe to Windows IT Pro
May 03, 2004 12:00 AM

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

Windows IT Pro
InstantDoc ID #42485
Rating: (15)

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=com
    1 - DC=savilltech,DC=com
    2 - CN=Schema,CN=Configuration,DC=savilltech,DC=com
    3 - DC=DomainDnsZones,DC=savilltech,DC=com
    4 - DC=ForestDnsZones,DC=savilltech,DC=com
    5 - DC=child1,DC=savilltech,DC=com
    6 - 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 cleanup
    metadata 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: quit
    metadata cleanup: select operation target
    select operation target: list domains
    
    "Found 2 domain(s)
    0 - DC=savilltech,DC=com
    1 - DC=child1,DC=savilltech,DC=com"
    
    select operation target: select domain 1
    
    "No current site
    Domain - DC=child1,DC=savilltech,DC=com
    No current server
    No current Naming Context"
    
    select operation target: quit
    metadata cleanup: remove selected domain
    
    "'DC=child1,DC=savilltech,DC=com' removed from server 'omega'"
    
    metadata cleanup: quit
    ntdsutil: quit
    
    "Disconnecting from omega...
    Gone!"

Related Content:

ARTICLE TOOLS

Comments
  • Khalid
    4 years ago
    Apr 18, 2008

    I followed steps and removed an accidently created forest under domain. users still see forest DC under primary domain listings. Forest DC crashed and I don't have a way to recover so I shutdown the machine. I checked all DCs and did not find entery for this forest. Please help to remove invalid forest from primary domain.

    Thanks

  • Brian
    5 years ago
    Mar 05, 2007

    I had to register to thank you for this help article.

    Thank You!

  • Matthias
    7 years ago
    Nov 17, 2005

    Thanks... working perfect

  • Richard
    7 years ago
    Oct 24, 2005

    Thanks, this is an extremely useful article, MS couldn't perform this for me, but your article enabled me to do it.

  • Anonymous User
    7 years ago
    Jul 22, 2005

    Worked perfectly. You guys came through again...

    Thanks :)

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.