Quick answer: Metadata cleanup removes a domain controller that no longer exists from Active Directory. On Windows Server 2016 and later, the easiest way is to delete the DC’s computer object in Active Directory Users and Computers; ntdsutil metadata cleanup is the fallback. Then remove its DNS records and site object.
In an Active Directory environment, we will look at how to remove and clean up a Domain Controller (DC) server using Metadata Cleanup commands. But under what circumstances should you perform a Metadata Cleanup?
If an Additional Domain Controller in your organization encounters a hardware or software failure and you need to remove its Additional DC role, you may no longer be able to access the affected server. In such cases, Metadata Cleanup can be performed from another available Domain Controller to remove the failed DC’s metadata from Active Directory.
In the Active Directory Users and Computers console, under the Domain Controllers Organizational Unit (OU), you will see the servers that are configured as Domain Controllers, including your Additional Domain Controllers.
Note: Before removing a Domain Controller from the existing environment using Metadata Cleanup, make sure that the DC is completely offline and will never be brought back online. Do not perform Metadata Cleanup if the Domain Controller may be restored or reconnected to the network.
Let’s Start Metadata Cleanup

On the Primary Domain Controller (PDC) server, open Command Prompt with Run as administrator privileges.
The commands we will use are listed below. You can also follow the process using the screenshots provided.
Ntdsutil
Ntdsutil: Metadata Cleanup
Metadata Cleanup: Connections
Server Connections: Connect to server HQDC1
Server Connections: Quit
Metadata Cleanup: Select Operation Target
Select Operation Target: List Sites
Select Operation Target: Select Site 6
(Select the site where the Domain Controller to be removed is located.)
Select Operation Target: List Domains
Select Operation Target: Select Domain 0
(Select the appropriate domain. In this example, 0 is selected because there is only one domain in the environment.)
Select Operation Target: List Server in Site
Select Operation Target: Select Server 0
(Select the Domain Controller for which Metadata Cleanup will be performed.)
Select Operation Target: QuitCode language: PHP (php)

Metadata Cleanup: Remove Selected ServerInformation about the selected Domain Controller will be displayed. Verify that the correct DC is selected, and confirm the operation if the information is correct.

After completing these steps, the Domain Controller role and its associated metadata have been removed from the existing Active Directory environment.
Post-Procedure Tasks Metadata Cleanup
After performing the Metadata Cleanup operation, verify that the corresponding Domain Controller object has been removed from the relevant site under Active Directory Sites and Services.

The Domain Controllers that were removed through the Metadata Cleanup process must also be removed from the Name Server (NS) records in both the Forward Lookup Zones and Reverse Lookup Zones.

This document provides the step-by-step procedures for performing Metadata Cleanup in an Active Directory environment. The objective is to ensure that the Metadata Cleanup process is completed thoroughly and in accordance with standard Active Directory practices.
The purpose of this procedure is to remove the Domain Controller role from an Active Directory environment when the Domain Controller is offline or has become permanently unavailable.
Important: Do not perform Metadata Cleanup until you have confirmed that the Domain Controller being removed is completely powered off and will not be brought back online. Performing Metadata Cleanup while the Domain Controller is still active or may reconnect to the environment can lead to Active Directory replication and structural issues.
When Do You Need Metadata Cleanup in Active Directory?
Metadata cleanup is the required procedure after a forced removal of Active Directory Domain Services, such as when a domain controller dies and you can never demote it properly. According to Microsoft, cleanup removes the data that identifies the domain controller to the replication system. It also removes File Replication Service and DFS Replication connections, and it attempts to transfer or seize any operations master (FSMO) roles that the retired domain controller held. You run it on a domain controller in the same domain as the one you removed.

Easier Option: Delete the Domain Controller in Active Directory Users and Computers
Since Windows Server 2008 you do not always need ntdsutil. If you use the Windows Server 2008 or newer version of Active Directory Users and Computers (or RSAT), deleting the domain controller’s computer account from the Domain Controllers OU performs the metadata cleanup automatically. Domain Admins membership, or equivalent, is the minimum required. The steps are:
- Open Active Directory Users and Computers and, if needed, right-click the domain node and choose Change Domain Controller to connect to a replication partner of the dead DC.
- Expand the domain, select Domain Controllers, right-click the dead DC and click Delete.
- In the Deleting Domain Controller dialog, select This Domain Controller is permanently offline and can no longer be demoted using the Active Directory Domain Services Installation Wizard (DCPROMO) and click Delete.
- If it was a global catalog server, click Yes. If it held FSMO roles, click OK to move them to the DC shown. You can move the roles elsewhere afterwards.
You can also delete the NTDS Settings object in Active Directory Sites and Services first, then delete the server object. The order matters: Sites and Services only cleans up metadata automatically when you delete NTDS Settings first.
Run ntdsutil as the Fallback
The ntdsutil steps earlier in this article are the command line route, and they are the right choice when you prefer a repeatable procedure. Connect to a domain controller that is a replication partner of the removed one, and run the commands as an Enterprise Admin when required. Microsoft’s version of the final step is a single command at the metadata cleanup: prompt:
remove selected server <ServerName>Code language: HTML, XML (xml)Review the confirmation dialog and click Yes. If you receive an error that the object cannot be found, the domain controller may already have been removed earlier.
Troubleshooting: Access Is Denied During Metadata Cleanup
If any of the methods returns Access is denied, the computer object or its NTDS Settings object is probably protected against accidental deletion. In Active Directory Users and Computers click View > Advanced Features, open the object properties, go to the Object tab and clear Protect object from accidental deletion. Then retry.
Verify the Domain Controller Is Really Gone
- In Active Directory Users and Computers, the DC no longer appears under Domain Controllers.
- In Active Directory Sites and Services, the server object has no NTDS Settings child. If nothing remains under the server object you can delete it. If a child remains, leave it, because another application uses the object.
- DNS no longer contains NS records and stale records for the DC, in both the forward and reverse lookup zones, as described above.
Then check that replication and FSMO ownership look healthy from a remaining domain controller:
repadmin /replsummary
repadmin /showrepl
dcdiag
netdom query fsmoReplication should show no errors against the removed server, and netdom query fsmo should list only live domain controllers as role holders.
Read more: How to Fix Outlook Search Not Updating in Shared Mailboxes
More learn metada cleanup: https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/deploy/ad-ds-metadata-cleanup
Read more: How to Migrate DHCP Server to a New Windows Server
Read more: How to Best Way Bypass the Microsoft Account Requirement During Windows 11 Installation
FAQ
When should I perform metadata cleanup in Active Directory?
After a domain controller has been forcibly removed or has failed permanently and cannot be demoted. Only do it when the DC is offline and will never be brought back.
Do I still need ntdsutil to clean up a domain controller?
Not usually. Deleting the DC in Active Directory Users and Computers from Windows Server 2008 onwards performs the metadata cleanup automatically. ntdsutil remains a valid command-line alternative.
What permissions do I need for metadata cleanup?
Domain Admins membership, or equivalent, is the minimum for the GUI methods. Use an Enterprise Admin account for ntdsutil if User Account Control or your environment requires it.
Why do I get Access is denied during metadata cleanup?
The computer object or NTDS Settings object is likely protected from accidental deletion. Show Advanced Features, open the Object tab and clear the protection.
What happens to the FSMO roles of the removed domain controller?
Metadata cleanup attempts to transfer or seize them, and the GUI shows the domain controller that will receive the roles. You can move them to a different DC afterwards.
References
Microsoft Learn: Clean up AD DS server metadata






