NTDS Error 0X000021AF – Missing DC Settings Object
Domain controller fails to start because AD can't find its own settings object in NTDS. This usually happens after a botched demotion or restore from backup.
1. Botched DCPROMO or Demotion
This is the #1 reason you're seeing 0X000021AF. What's actually happening here is that Active Directory wrote the NTDS Settings object into the database during promotion, but then something went wrong — maybe you force-rebooted mid-promotion, or demoted the server but left AD files behind. The Directory Service boots up, looks for its own NTDS Settings object in the Configuration partition under CN=Servers,CN=Default-First-Site-Name,CN=Sites, and finds nothing. Dead stop.
Real-world trigger: You ran DCPROMO on a Server 2019 box, it hung at "Configuring the service", you hit reset, and now it won't boot past the black screen with the error.
The Fix
Don't bother with GUI tools — they're useless here because the service won't start. Boot into Directory Services Restore Mode (DSRM). For Server 2016 and above, that means pressing F8 during boot (it's still there, just fast) or using bcdedit /set safeboot dsrepair from recovery console.
- Boot to DSRM with the DSRM password you set during promotion (or use the recovery password if you forgot it).
- Open an elevated command prompt.
- Run
ntdsutil→metadata cleanup→select operation target. - List sites, then servers, find this DC, and select it.
- Exit and run
remove selected server. This kills the orphaned metadata in the database. - Now exit all the way out of ntdsutil.
- Run
reg add HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Parameters /v Replica Machine Object /t REG_SZ /d CN=NTDS Settings,CN=YOURDCNAME,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=yourdomain,DC=com /f— but replace YOURDCNAME and yourdomain parts with your real values. This tells AD where to look (and it'll recreate the object). - Reboot to normal mode. It should boot clean.
Why step 7 works: The registry value points to a non-existent object, but on first boot the Directory Service creates it because it sees the replica machine object is missing in the database. It's a self-healing mechanism that only fires when the service starts and finds the path empty.
2. Corrupted NTDS Database from Bad Restore
Second most common: you restored Active Directory from a system state backup that was taken on a different DC, or the backup was incomplete. The database is missing the Settings object for this DC because the backup contained a different server's identity.
Real-world trigger: You’re cloning a VM template and restoring AD from backup to spin up a new DC, but the backup was from an old DC named DC01, and you renamed this one to DC02. The NTDS Settings object still points to DC01.
The Fix
Same start — boot to DSRM. But here, you need to check the database integrity first before touching anything.
- In DSRM, open cmd as admin.
- Run
ntdsutil→files→integrity. If it reports errors, runsemantic database analysisthengo fixup. - Now check the Settings object exists:
dsquery * CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=yourdomain,DC=com -filter "(objectClass=server)" -attr cn. If your DC name isn't in the list, you're in the same boat as cause #1. - If the DC name is there but the Settings object is missing, use ADSI Edit (install via
dism /online /add-capability /CapabilityName:Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0from an elevated prompt). Connect to the Configuration partition, navigate toCN=Sites → CN=Default-First-Site-Name → CN=Servers → CN=YOURDCNAME. Right-click YOUDCNAME → New → Object → choose nTDSDSA. Default attributes are fine. - Reboot to normal mode.
Why the object is missing: The database thinks it's a different server. The DSA object is literally the NTDS Settings child object under the server object. Without it, the Directory Service can't start because it has no identity in the replication topology.
3. Sysvol or NETLOGON Share Corruption
Less common, but I've seen it on Server 2012 R2 after a power loss. The NTDS Settings object is fine, but the Sysvol folder structure is wrecked. The service fails trying to read Group Policy objects from Sysvol during boot, and the error code gets misreported as 0X000021AF because the log is ambiguous.
Real-world trigger: A dirty shutdown on a Server 2012 R2 DC, then on reboot the error shows up. Event Log shows 0X000021AF but also warning 1002 about DFSR replication.
The Fix
- Boot to DSRM.
- Check Sysvol:
dir C:\Windows\SYSVOL\sysvol\yourdomain.com. If it's empty or missing folders, you need to restore Sysvol from backup or force a replication. - Run
net shareto see if SYSVOL and NETLOGON shares are still there. If missing, rundfsradmin membership listto see if the content set is missing. - Use
dfsradmin membership set /rgname:domain system volume /rfname:sysvol share /memname:YOURDCNAME /isdeleted:false /isfolder:falseto re-create the membership, thendfsradmin membership reback. - Restart the DFSR service and reboot to normal mode.
Why this fixes it: When Sysvol is broken, the Directory Service waits for Sysvol to initialize before continuing. If Sysvol never comes up, the service times out and throws a generic error that looks like a missing Settings object.
| Cause | Symptom Check | Fix Action |
|---|---|---|
| Botched demotion | DC name missing from CN=Sites | Metadata cleanup + registry override |
| Bad restore | DC name exists but no nTDSDSA child | ADSI Edit to create nTDSDSA object |
| Sysvol corruption | Sysvol folder empty or missing shares | Restore DFSR membership |
One last thing: If none of these work, check if the server's NTDS\ntds.dit file is on a compressed volume — Active Directory hates compression. Right-click C:\Windows\NTDS → Properties → Advanced → uncheck Compress contents. Reboot to DSRM and run esentutl /r edb to replay the log files, then try normal boot again.
Was this solution helpful?