First thing: check DNS and replication
I've seen 0X000020E4 more times than I care to count. Nine times out of ten, it's because a domain controller got demoted or yanked out of the network without proper cleanup. The error literally means Active Directory is looking for a naming context (NC)—like DC=domain,DC=com or a domain partition—and can't find it on the server you're querying. The naming context itself still exists in the forest, but the metadata or DNS points to a dead server.
First, check DNS on the failing DC. Open DNS Manager, expand your forward lookup zone, and look under _msdcs.<yourdomain>. If you see old SRV records pointing to a DC that no longer exists, that's your problem. Delete them. Also check the _tcp folder for stale LDAP or Kerberos records. I had a client last month whose entire print queue died because of this—a single stale SRV record made the print server think it couldn't find the domain. Took me 10 minutes to clean it up.
Run this from an elevated command prompt to verify replication:
repadmin /replsummary
If you see failures with 0X000020E4, the source DC listed in the error is likely gone. The fix is metadata cleanup, covered below.
Cause 1: Orphaned domain controller metadata
This is the most common cause. When you demote a DC using dcpromo or Server Manager, it should clean up its own metadata. But if the demotion fails halfway, or if someone just turned off the server, the metadata sticks around in AD and DNS. Other DCs still try to replicate with the ghost DC, get 0X000020E4, and stop replicating.
Fix: Clean up metadata using ntdsutil. This isn't hard, but you need to be careful. Do this on a working DC (preferably the one holding the PDC emulator role).
- Open an elevated command prompt.
- Type
ntdsutiland press Enter. - Type
metadata cleanupand press Enter. - Type
connectionsand press Enter. - Type
connect to server <your working DC>(e.g.,connect to server DC01). - Type
quitto exit connections. - Type
select operation targetand press Enter. - Type
list domains— note the domain index number (usually 0). - Type
select domain 0(or whatever index your domain is). - Type
list sites— note your site index. - Type
select site <site index>. - Type
list servers in site— find the dead DC and note its index. - Type
select server <dead DC index>. - Type
quitto go back to metadata cleanup menu. - Type
remove selected server— confirm the prompt. - Type
quittwice to exit.
After that, run repadmin /syncall /AdeP on the remaining DCs to force replication. If the error was on a specific server, give it a few minutes and check dcdiag /test:replications.
I once spent two hours on a call with a client who swore they'd demoted the DC properly. Turned out they'd used the Windows GUI but the server had a pending reboot. Metadata was still there. The fix above took 3 minutes.
Cause 2: DNS missing or wrong SRV records for the naming context
If metadata cleanup didn't fix it, the problem is probably DNS. AD relies on SRV records to locate naming contexts. If a DC that hosted a specific NC (like CN=Schema,CN=Configuration,DC=...) is gone but its SRV records remain, other DCs will try to replicate and fail.
Fix: Use ADSI Edit to verify the naming context references, then fix DNS. First, open ADSI Edit on a working DC. Right-click ADSI Edit in the left pane and choose Connect to. Under Select a well-known Naming Context, choose Configuration. Navigate to CN=Sites,CN=Configuration,DC=..., expand your site, then CN=Servers. Find the dead server entry and delete it. This removes it from AD completely.
Then, check DNS again. Delete any SRV records under _msdcs, _tcp, _udp, and _sites that point to the dead DC. You can do this manually in DNS Manager or script it. If you're in a hurry, run this on a working DC to force registration of proper SRV records:
ipconfig /registerdnsThen restart the Netlogon service on all DCs (
net stop netlogon && net start netlogon).
Had a client with a multi-site setup where a remote DC was decommissioned but DNS scavenging was off. Stale records from 2019 were still there. Took me 30 minutes to clean all three sites. After that, replication flew.
Cause 3: Replication from a retired or non-existent domain controller
Sometimes the error shows up on a DC that's still alive but trying to replicate an NC from a DC that was never properly demoted. This is common in environments where someone built a temporary DC for a migration and forgot to clean up.
Fix: Use repadmin to list and remove stale replication partners. Open an elevated command prompt on the DC showing the error. Run:
repadmin /showreplLook for entries under DSA object GUID or Source DC that show a failed NC with
0X000020E4. Note the GUID of the dead DC.
Then, remove that source as a replication partner:
repadmin /options <localDC> +DISABLE_INBOUND_REPLWait a minute, then re-enable:
repadmin /options <localDC> -DISABLE_INBOUND_REPLThis forces the local DC to re-evaluate its replication topology. After that, run
repadmin /syncall /AdeP again.
If the GUID is from a dead DC you already cleaned metadata from, you might need to force removal using ADSI Edit—navigate to CN=NTDS Settings under the dead server object in Configuration and delete the CN=NTDS Settings object.
One time I saw this on a 2012 R2 DC that was still trying to replicate a read-only domain controller that had been physically destroyed. The repadmin /options trick fixed it instantly.
Quick-reference summary
| Cause | Fix | Tools |
|---|---|---|
| Orphaned DC metadata | Clean up with ntdsutil, then force replication | ntdsutil, repadmin |
| Stale DNS SRV records | Remove old SRV records, register fresh ones | DNS Manager, ipconfig, net stop/start netlogon |
| Replication partner from dead DC | Disable/re-enable inbound replication, delete NTDS Settings | repadmin, ADSI Edit |
If the error persists after all that, check for lingering objects using repadmin /removelingeringobjects on the NC. But honestly, 95% of the time it's one of those three. Start with metadata cleanup—it's the most common reason I see this code in the field.