How to clean up server metadata using command line?

How to clean up server metadata using command line?

1.>From Active Directory user and computer:-
When you use the Active Directory Users and Computers console (Dsa.msc) that is included with Windows Server 2008 or Windows Server 2008 R2 to delete a domain controller computer account from the Domain Controllers organizational unit (OU), the cleanup of server metadata is performed automatically. Previously, you had to perform a separate metadata cleanup procedure.
2.>From site and services:-

You can also use the Active Directory Sites and Services console (Dssite.msc) to delete a domain controller’s computer account, which also completes metadata cleanup automatically. However, Active Directory Sites and Services removes the metadata automatically only when you first delete the NTDS Settings object below the computer account in Dssite.msc.

From NTDSUTIL command line:-

As an alternative, you can clean up metadata by using Ntdsutil.exe, a command-line tool that is installed automatically on all domain controllers and servers that have Active Directory Lightweight Directory Services (AD LDS) installed. Ntdsutil.exe is also available on computers that have RSAT installed.

To clean up server metadata by using Ntdsutil

  1. Open a command prompt as an administrator: On the Start menu, right-click Command Prompt, and then click Run as administrator. If the User Account Controldialog box appears, provide Enterprise Admins credentials, if required, and then click Continue.
  2. At the command prompt, type the following command, and then press ENTER:


  1. At the ntdsutil: prompt, type the following command, and then press ENTER:

metadata cleanup

  1. At the metadata cleanup: prompt, type the following command, and then press ENTER:

remove selected server <ServerName>


remove selected server <ServerName1> on <ServerName2>

ntdsutil: metadata cleanupInitiates removal of objects that refer to a

decommissioned  domain controller.

remove selected serverRemoves objects for a specified,

decommissioned domain controller from

a specified server.

<ServerName> or <ServerName1>The distinguished name of the domain controller

whose metadata you want to

remove, in the form


cn=Sites, cn=Configuration,


If you specify only one server name, the objects

are removed from the current domain controller.

on <ServerName2>Specifies removing server metadata

on <ServerName2>, the Domain Name  System

(DNS) name of the domain

controller to which you want to connect

. If you have identified replication partners in

preparation for  This  procedure, specify

a domain controller that is a replication  partner

of the removed domain controller.

  1. In Server Remove Configuration Dialog, review the information and warning, and then click Yes to remove the server object and metadata.


At this point, Ntdsutil confirms that the domain controller was removed successfully. If you receive an error message that indicates that the object cannot be found, the domain controller might have been removed earlier.

If you have any questions feel free to contact me on also follow me on facebook @windowstechno to get updates about new blog posts.

How useful was this post?

Click on a star to rate it!

Leave a Reply