Article
Direct Inward Dialing: +1 408 916 9892
When a domain controller is permanently offline but its Active Directory objects remain, it can continue to appear in the directory and replication topology. This stale information can cause replication errors, stale FSMO role holders, and DNS inconsistencies until Active Directory cleanup is complete.
Metadata cleanup removes the Active Directory data that identifies the failed domain controller to the replication system. It can be performed using graphical tools or ntdsutil.
A domain controller typically ends up “existing” in Active Directory metadata without being functional when:
Before removing the domain controller metadata:
Metadata cleanup is a destructive operation. Make sure the domain controller will not be brought back online before removing its metadata, and never remove the metadata of a domain controller that still exists.
A failed domain controller may still be recorded as the owner of one or more FSMO roles. Run:
netdom query fsmo
If the failed domain controller still owns a role:
Metadata cleanup can attempt to transfer or seize FSMO roles associated with the retired domain controller, but verify the final role ownership after cleanup by running netdom query fsmo again.
When you delete a domain controller’s computer object using the Active Directory Users and Computers (ADUC) or Active Directory Administrative Center version in Remote Server Administration Tools (RSAT), metadata cleanup is performed automatically. The server object and the computer object are deleted too, so you don’t need ntdsutil for most day-to-day cases.
Use this method when you can’t demote the domain controller through the normal removal wizard because it’s already offline or unreachable.
Ntdsutil is a command-line tool that is installed on domain controllers and is also available on computers that have RSAT installed. Use it if you prefer to work from the command line.
ntdsutil
metadata cleanup
connections
connect to server <ServerName>
quit
select operation target
list domains
select domain <number>
list sites
select site <number>
list servers in site
select server <number>
quit
remove selected server
In the Server Remove Configuration dialog, review the warning carefully, then click Yes to remove the server object and its metadata. Ntdsutil confirms that the domain controller was removed successfully.
If ntdsutil reports that the object cannot be found, the domain controller might already have been removed.
After metadata cleanup, confirm that no objects for the removed domain controller remain:
You can also remove the domain controller directly in Sites and Services. Delete the objects in this order: NTDS Settings first, then the server object, then the computer object.
If you receive an Access is denied message, see the troubleshooting section below.
Metadata cleanup doesn’t remove DNS records automatically. In the DNS Manager snap-in, remove every record that references the retired domain controller:
After removing the failed domain controller, verify that no remaining domain controllers reference it.
Failures at this stage point to incomplete cleanup or a topology issue that needs attention.
If metadata cleanup returns an Access is denied message, check whether the domain controller’s computer object or NTDS Settings object is protected against accidental deletion. In Active Directory Users and Computers:
Microsoft documents this as a possible cause of access-denied errors during metadata cleanup.
You can use PowerShell or ntdsutil. Seize the role onto a healthy domain controller.
Move-ADDirectoryServerOperationMasterRole -Identity <HealthyDC> `
-OperationMasterRole PDCEmulator -Force
The GUI cannot seize a role. Seize the RID Master only when you’re sure the old holder can’t return. The cmdlet advances the next RID pool by 30,000 and ntdsutil by 10,000.
Yes, as a last resort. In ADSI Edit, go to Configuration NC > CN=Sites > your site > CN=Servers, and delete the orphaned NTDS Settings. Also check LostAndFoundConfig for an orphaned NTDS Settings object, and make sure the change replicates to all domain controllers.
ADSI Edit changes are permanent, so take a system state backup first. You can also use ADSI Edit to remove stale SYSVOL replication references.
Errors usually mean leftover metadata or DNS records. Run DCDiag /Test:DNS /e /v to check DNS forwarders, delegation, and record registration. Then run repadmin /replsummary, and re-check the Sites and Services server list and the DNS Name Servers tab.
A graceful demotion contacts replication partners, replicates outstanding changes, and cleanly removes the domain controller from the directory. A forced demotion skips replication and does not clean up the domain controller’s metadata. Metadata cleanup is normally part of demotion.
When a domain controller is no longer reachable, it becomes a separate step that you run from another domain controller. Metadata cleanup only removes the domain controller’s records from AD. It doesn’t touch the failed server.