Active Directory

How to Clean Up Active Directory Metadata for a Domain Controller That Was Forcibly Removed

Aseem Kishore
16 min read

The Back Room Tech is reader-supported. We may earn a commission when you buy through links on our site. Learn more.

A domain controller (DC) died, or someone forced it out, and Active Directory still thinks it exists. Its computer object, NTDS Settings object, FSMO roles, and DNS records are all still there. Other DCs keep trying to replicate with a server that’s gone, and your event logs fill up with errors.

The fix hinges on one question: can you still see the dead DC in Active Directory Users and Computers? If you can, Microsoft says deleting it there runs metadata cleanup automatically on Windows Server 2008 and later RSAT versions of the console. ntdsutil is the command-line alternative, useful when the GUI path fails or on Server Core. Microsoft’s procedure doesn’t cover DNS, so stale DNS records are on you, and dcdiag and repadmin confirm the result.

Prerequisites

  • Supported versions: Windows Server 2016, 2019, 2022, or 2025 Active Directory Domain Services (AD DS). This matches the “Applies to” list on Microsoft’s metadata cleanup article (retrieved October 28, 2026). For Windows Server 2008 through 2012 R2, Microsoft’s archived documentation covers the same tasks.
  • Where to run it: A healthy DC in the same domain, ideally a direct replication partner of the dead DC. You can also run the GUI consoles from a machine with RSAT installed, connected to that DC. Never run cleanup from the removed DC itself.
  • Permissions: Microsoft lists membership in Domain Admins, or equivalent, as the minimum for the GUI procedures. Its command-line steps note you may be prompted for Enterprise Administrator credentials if required. Delegated rights can also work, as long as they allow deleting the objects involved.
  • Tools: dsa.msc, dssite.msc, dnsmgmt.msc, ntdsutil, dcdiag, and repadmin. They’re available on domain controllers, and Microsoft notes ntdsutil is also available on computers with RSAT installed. Tool availability on an RSAT machine depends on which AD DS and DNS features you installed, so confirm each one runs before you start. No extra license needed.
  • Elevation: Open every console and Command Prompt with Run as administrator.

Examples below use corp.example.com as the domain, DC01 as the healthy DC, and DC03 as the dead one.

Warning: Metadata cleanup is permanent. Make sure the dead DC will never come back online with its old database. If it might return, rebuild it from scratch after cleanup. Don’t boot the old disk or VM snapshot.

Quick Diagnosis

Run these from an elevated prompt on DC01 before you change anything.

1. Confirm AD still lists the dead DC

:: Lists every server object in the forest's Sites container
dsquery server -forest

Illustrative output (not captured from a live run), with the dead DC still present:

"CN=DC01,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=corp,DC=example,DC=com"
"CN=DC03,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=corp,DC=example,DC=com"

Save this listing to identify the removed server. The current ntdsutil sequence below uses the removed server’s name.

2. Check which FSMO roles the dead DC held

netdom query fsmo

If any role points at DC03, note it. Metadata cleanup attempts to move it, but you’ll confirm the result afterward. See the FSMO issue below.

3. Capture the current replication errors

:: /replsummary gives one line per DC with failure counts
repadmin /replsummary

You’ll likely see failures against DC03. Keep this output so you can compare it after cleanup.

Common Issues and Solutions

Problem: You’re not sure whether you need ntdsutil at all

Symptoms:

  • The dead DC still appears in the Domain Controllers OU in Active Directory Users and Computers (ADUC)
  • Older forum posts tell you to go straight to ntdsutil

Why it happens: Those posts date from before Windows Server 2008, when a GUI delete left metadata behind. According to Microsoft’s metadata cleanup procedure, deleting the DC’s computer object from the Domain Controllers OU in ADUC performs metadata cleanup automatically. Active Directory Sites and Services (ADSS) also cleans up automatically, but only when you delete the DC’s NTDS Settings object first. Follow one of these two documented paths as written; they aren’t interchangeable step for step.

Fix (GUI path):

  • Open dsa.msc as administrator.
  • Right-click the top node and choose Change Domain Controller. Select a healthy replication partner, such as DC01.
  • Expand the domain and open Domain Controllers.
  • Right-click DC03 and choose Delete. Confirm the first prompt.
Domain Controllers OU with the offline DC object (DC03) selected and the right-click context menu open with Delete highlighted
  • In the Deleting Domain Controller dialog, check This Domain Controller is permanently offline and can no longer be demoted using the Active Directory Domain Services Installation Wizard (DCPROMO), then click Delete. On current Windows Server versions the checkbox may instead read Delete this Domain Controller anyway. It is permanently offline and can no longer be removed using the removal wizard.
Deleting Domain Controller dialog for DC03 with the permanently offline checkbox selected and the Delete button visible
  • If the DC was a global catalog server, click Yes to continue. If it held operations master (FSMO) roles, click OK to move them to the DC shown. You can’t change that target here, so check FSMO placement afterward.

Verify: Run dsquery server -forest again. DC03 should no longer be listed.

Tip: If the GUI delete works, skip the ntdsutil section and go to DNS cleanup.

Problem: “Access is denied” when deleting the DC or NTDS Settings object

Symptoms:

  • The delete fails right away with Access is denied
  • This happens even when you’re signed in as a Domain Admin

Why it happens: A common cause is Protect object from accidental deletion on the computer or NTDS Settings object. Microsoft’s procedure says to clear it if you get Access is denied with either the GUI or ntdsutil. Missing delete permissions, or a deny ACL on the object or its container, can also cause the error.

Fix:

  • In ADUC (or ADSS for the NTDS Settings object), click View > Advanced Features. The Object tab stays hidden until you do this.
  • Right-click the object, choose Properties, and open the Object tab.
  • Clear Protect object from accidental deletion, then click OK.
Properties dialog for the DC03 computer object on the Object tab with the Protect object from accidental deletion checkbox visible, Advanced Features enabled
  • Retry the delete.

PowerShell alternative (requires the ActiveDirectory module):

# Clears the accidental-deletion flag on the dead DC's computer object
Set-ADObject -Identity "CN=DC03,OU=Domain Controllers,DC=corp,DC=example,DC=com" -ProtectedFromAccidentalDeletion $false

Verify: Reopen the Object tab and confirm the box is cleared. If the delete still fails, check your group membership with whoami /groups (Microsoft lists Domain Admins or equivalent as the minimum). Group membership alone doesn’t prove you have delete rights: check the object’s Security tab for deny entries or delegation that blocks deletion.

Problem: The dead DC doesn’t appear in ADUC

Symptoms:

  • The Domain Controllers OU doesn’t list DC03
  • repadmin still reports errors against it

Why it happens: Your console may be connected to a DC with a different view of the directory. It might also not be a replication partner of the dead server.

Fix: Right-click the console root, choose Change Domain Controller, and pick a healthy direct partner. Refresh the view. Is the computer object truly gone while dsquery server still lists DC03? Then the NTDS Settings object was left behind. Use the next fix or ntdsutil.

Verify: dsquery server -forest should match what you see in ADSS.

Problem: The NTDS Settings object in Sites and Services won’t go away

Symptoms:

  • DC03 is gone from ADUC, but Sites > SiteName > Servers > DC03 > NTDS Settings still exists

Why it happens: Per Microsoft’s metadata cleanup procedure, ADSS removes the metadata automatically only when you first delete the NTDS Settings object below the server. Microsoft’s ADSS steps then delete the server object.

Fix:

  • Open dssite.msc as administrator and switch to a healthy DC using Change Domain Controller.
  • Expand Sites > SiteName > Servers > DC03.
  • Right-click NTDS Settings, choose Delete, and click Yes. In the Deleting Domain Controller dialog, select This Domain Controller is permanently offline… and click Delete. Answer the global catalog and FSMO prompts if they appear.
NTDS Settings object under Sites > Default-First-Site-Name > Servers > DC03 selected with the Delete context menu option visible
  • Right-click the DC03 server object, choose Delete, and click Yes. If a child object other than NTDS Settings still appears under it, stop: Microsoft says not to delete a server object that another application is still using.

Verify: dsquery server -forest no longer lists DC03.

Problem: ntdsutil “remove selected server” fails or never connects

Symptoms:

  • connect to server reports a bind error or The RPC server is unavailable
  • remove selected server fails, or the syntax from an old forum post is rejected

Why it happens: Usually one of two things. You pointed connect to server at the dead DC (or another unreachable one). Or you used the older remove selected server X on Y form from legacy docs. Microsoft’s current page connects to the healthy server first. Then it removes the dead one without the on clause.

Fix: Open an elevated Command Prompt on DC01 and run the current sequence:

ntdsutil
metadata cleanup
connections
:: Connect to a HEALTHY DC, never the dead one
connect to server DC01
quit
:: Remove the dead server, not the healthy connection target
remove selected server DC03

Microsoft’s current procedure uses remove selected server <ServerName> after connecting to a healthy replication partner. Use DC03 for the removed server in this example, and verify the target in the confirmation dialog before accepting. The archived Windows Server 2008 R2 procedure describes a DN form; do not mix that historical example into the current sequence.

A Server Remove Configuration Dialog appears next. Read it and click Yes only when it names the permanently removed DC. Metadata cleanup attempts to transfer or seize its FSMO roles, so check placement afterward. Type quit twice to exit.

Ntdsutil connected to healthy DC01, with remove selected server DC03 and the server removal confirmation dialog.

For command details, see the ntdsutil reference.

Verify: Run dsquery server -forest. Then follow Microsoft’s check: ADUC should show no DC03 object under Domain Controllers, and in ADSS the DC03 server object should have no NTDS Settings object. If the server object has no child objects, you can delete it. If a child object appears, don’t delete the server object, because another application is using it.

Problem: The dead DC held FSMO roles

Symptoms:

  • netdom query fsmo lists DC03 for one or more roles

Why it happens: Nobody transferred the roles before the DC died.

Fix: Microsoft says metadata cleanup attempts to transfer or seize any FSMO roles the removed DC held. In the GUI you click OK to move them to the DC shown, and you can’t change that target from the dialog, so choose your target DC on purpose in Change Domain Controller or connect to server. Treat this as an attempt, not a guarantee. If any role still points at DC03 afterward, or you want it on a different DC, transfer or seize it deliberately with our FSMO role transfer and seizure guide.

Verify:

netdom query fsmo

Every role should point to a live DC.

Problem: Replication still fails with error 8240

Symptoms:

  • repadmin or the Directory Service event log shows Win32 error 8240, “There is no such object on the server,” and points at the removed DC

Why it happens: Metadata for the removed DC still exists somewhere in the forest. Other DCs keep trying to replicate with it.

Fix: Confirm the cleanup actually completed: dsquery server -forest shouldn’t list DC03, and ADSS shouldn’t show an NTDS Settings object under it. If something remains, repeat Microsoft’s documented procedure (GUI or ntdsutil) for that DC. Don’t hand-delete configuration-partition or naming-context objects. If it still won’t clear, work through Microsoft’s 8240 guide linked below.

Once you’ve confirmed the cleanup ran against the right DC and object, you can let normal replication converge, or trigger it once from the DC where you ran the cleanup:

:: /A all partitions, /e cross-site, /d identify servers by DN
repadmin /syncall DC01 /A /e /d

This requests broad synchronization from DC01. Check the local repadmin /syncall /? help and your topology before running it, and use it once outside busy periods rather than repeatedly.

For deeper causes, see Microsoft’s error 8240 troubleshooting guide.

Verify: repadmin /showrepl shows no partner entries for DC03.

Problem: DNS still returns the dead DC

Symptoms:

  • nslookup DC03.corp.example.com still resolves
  • Clients get LDAP or Kerberos referrals to a server that’s gone

Why it happens: Microsoft’s base procedure removes AD DS objects. It doesn’t walk through DNS record cleanup. Stale A, SRV, CNAME, and NS records are common after a forced removal. The steps below are standard admin practice built on top of that page.

Fix:

  • Open dnsmgmt.msc on a DNS server that hosts the AD zone.
  • In corp.example.com, delete the DC03 host (A/AAAA) record.
  • Expand _msdcs.corp.example.com and look for SRV records under _tcp, dc, gc, and pdc that still point to DC03. Also look for a GUID-named CNAME that points to DC03. Confirm each record targets the removed DC, not a live one, before you delete it, and export the zone or note the records first so you can restore them if needed.
  • Open Properties > Name Servers on each zone and remove DC03.
DNS Manager with the _msdcs.corp.example.com subzone expanded showing a leftover SRV record referencing DC03.corp.example.com selected for deletion

To search for leftovers from PowerShell:

# Lists SRV records in the _msdcs zone whose target starts with DC03
# Adjust the filter to your naming, and review the results before deleting anything
Get-DnsServerResourceRecord -ZoneName "_msdcs.corp.example.com" -RRType Srv | Where-Object { $_.RecordData.DomainName -like "DC03*" }

Verify: nslookup -type=SRV _ldap._tcp.dc._msdcs.corp.example.com returns only live DCs.

Problem: SYSVOL replication still references the dead DC

Symptoms:

  • DFS Replication events mention DC03
  • dcdiag SYSVOL-related tests show warnings

Why it happens: Microsoft states metadata cleanup removes FRS and DFS Replication connections. Leftovers are rare, but they can happen after a partial cleanup.

Fix: Run the SYSVOL checks:

dcdiag /test:sysvolcheck /test:dfsrevent

Then look for a leftover DFSR member object:

# Lists SYSVOL DFSR topology members; DC03 should not appear
Get-ADObject -SearchBase "CN=Topology,CN=Domain System Volume,CN=DFSR-GlobalSettings,CN=System,DC=corp,DC=example,DC=com" -Filter * -SearchScope OneLevel

If DC03 still appears after cleanup and replication have converged, don’t delete it on the spot. Removing DFSR topology objects is destructive: deleting the wrong object, or one that’s still in use, can break SYSVOL replication. First confirm DC03 is permanently gone, take a current System State backup of a healthy DC, and check the DFS Replication event log for current SYSVOL replication health. Then follow Microsoft’s SYSVOL DFSR guidance or open a support case before removing anything.

Verify: Re-run both dcdiag tests and confirm they pass.

Verification: dcdiag and repadmin

Run these on each remaining DC once cleanup and replication have settled. The blocks below show what a clean result looks like. Your server names, site names, and timestamps will differ. Check exact switches against the dcdiag and repadmin references.

dcdiag /v /c /e /q
:: /e tests all DCs in the forest; /q prints errors only; /c runs comprehensive tests

A clean run with /q prints little or nothing. That silence is the good news. Without /q, the key lines look like this (illustrative, not captured from a live run):

   Testing server: Default-First-Site-Name\DC01
      Starting test: Replications
         ......................... DC01 passed test Replications
Elevated Command Prompt on DC01 showing dcdiag output after cleanup with the Connectivity and Replications tests passed and no references to DC03
repadmin /replsummary

Illustrative output:

Source DSA          largest delta    fails/total %%   error
 DC01                      08m:12s    0 /  10    0
 DC02                      07m:55s    0 /  10    0
Elevated Command Prompt showing repadmin /replsummary output with zero failures and no DC03 entry in the Source or Destination DSA lists

Success means three things: DC03 is absent, the failure count is 0, and the error column is empty.

Error Messages Quick Reference

ErrorMeaningFix
Access is deniedAccidental-deletion protection is on, or you lack delete rightsClear the Object tab flag; confirm Domain Admins or equivalent rights and check for deny ACLs
8240: There is no such object on the serverLeftover metadata for a removed DCConfirm the cleanup completed, repeat the documented procedure if needed, then let replication converge
The RPC server is unavailable (1722)connect to server targeted an unreachable DCConnect to a healthy, reachable DC
remove selected server rejectedOld or mismatched command syntax, or an incorrect targetConnect to a healthy partner, then use the current remove selected server <ServerName> sequence
Stale SRV or A records resolveDNS isn’t covered by metadata cleanupDelete records manually in DNS Manager

Platform-Specific Notes

Server Core DCs

Server Core has no GUI consoles. Use ntdsutil locally, or run ADUC, ADSS, and DNS Manager from an RSAT machine. Then use Change Domain Controller to point them at the core DC.

RSAT on a Windows client

Install the AD DS and DNS RSAT features, then run the consoles with an account that has the required rights. Check that dcdiag, repadmin and ntdsutil actually run on that machine; if one is missing, run it on a DC instead.

Configuration Mistakes to Avoid

  • Targeting the wrong DC: Always connect to a healthy partner before you delete. The cleanup tries to move FSMO roles to that DC.
  • Deleting the server object before NTDS Settings in ADSS: Delete NTDS Settings first.
  • Skipping the permanently-offline checkbox: The delete won’t proceed without it.
  • Following old syntax: remove selected server <ServerName1> on <ServerName2> comes from legacy docs. Use connect to server, then remove selected server.

Getting Help

  • Event logs: Check Applications and Services Logs > Directory Service, DFS Replication, and DNS Server in Event Viewer.
  • Debug info to collect: Save the output of repadmin /showrepl * /csv > C:\Temp\showrepl.csv, dcdiag /v /c /e > C:\Temp\dcdiag.txt, and netdom query fsmo.
  • Community: Microsoft Q&A has threads on this exact scenario.
  • Official docs: Demote domain controllers and domains.

Prevention Tips

  • Demote normally whenever possible. A graceful demotion removes metadata for you.
  • Run at least two DCs per domain. Put them on separate hosts. A Hyper-V VM plus a small mini PC works well in a homelab.
  • Protect DC hardware. Put a UPS in front of DC hosts so a power cut doesn’t corrupt the database.
  • Back up System State. Keep regular backups on a NAS drive or another offsite target.
  • Document FSMO placement. Run netdom query fsmo after any change.
Help & Answers

Frequently Asked Questions

3 questions

Do I need ntdsutil if I can still see the dead DC in ADUC?

Usually not. On Server 2008 and later, deleting it in ADUC runs metadata cleanup automatically.

Does metadata cleanup remove DNS records?

Microsoft’s metadata cleanup procedure doesn’t cover DNS records, so check for stale host, SRV, CNAME and NS records yourself and remove the ones that point to the removed DC.

Do I need to seize FSMO roles manually?

Only if the cleanup’s automatic transfer or seizure doesn’t complete, or you want the roles on a different DC. Check netdom query fsmo afterward either way.

Wrapping Up

Start in the GUI, fall back to ntdsutil, then clean DNS and prove the result with dcdiag and repadmin. When the GUI delete fails, check the accidental-deletion flag, your delete rights and which DC the console is connected to first.

StepActionApplies To
1Diagnose with dsquery, netdom, repadminAll
2Delete in ADUC/ADSS (clear protection flag if needed)GUI path
3ntdsutil metadata cleanupGUI failed or scripted
4Confirm FSMO placementDC held roles
5Clean DNS and check SYSVOLAll
6Verify with dcdiag and repadminAll

Last updated: October 28, 2026 | Applies to Active Directory Domain Services on Windows Server 2016, 2019, 2022, and 2025

Sources