Fix ERROR_DS_SUB_CLS_TEST_FAIL 0X000020C7 in AD
Active Directory replication fails with sub-class test error. This usually means a schema conflict or a broken object class hierarchy. Here's how to fix it.
Cause #1: Schema conflict between domain controllers
This is the most common cause. You'll see ERROR_DS_SUB_CLS_TEST_FAIL (0X000020C7) when one domain controller has a newer schema version than another, and replication tries to apply an object that references a class or attribute the receiver doesn't recognize yet.
This happens most often after you've extended the schema — maybe you installed Exchange, a third-party app, or ran a schema update manually. One DC got the update, the other didn't, and now replication chokes.
How to confirm this is the problem
Open an elevated command prompt. Type this:
repadmin /showrepl
Look for the source DC that's failing. You should see the 0X000020C7 error next to a specific directory partition. Then run:
repadmin /showobjmeta <source-DC> <DN-of-failing-object>
If you see an attribute with schemaIDGUID that's missing on the receiving DC, that's your culprit.
Fix it: force schema sync
- On the receiving DC (the one getting the error), open an elevated command prompt.
- Run
repadmin /syncall /AdeP. This forces replication of all partitions including schema. Wait for it to complete — it can take a few minutes. - Check the event log for
Event ID 1925orEvent ID 1988that confirm the schema update applied. - After that, run
repadmin /replicate <target-DC> <source-DC> DC=domain,DC=comto manually retry the failed replication. - Verify with
repadmin /showrepl— the error should be gone.
What if that doesn't work? Sometimes the schema conflict is deeper. You might need to demote the receiving DC and promote it again. That's drastic but reliable. I've had to do it twice in 10 years. Don't jump to it unless you've exhausted everything else.
Cause #2: Corrupt or orphaned object class in Active Directory
Less common but nastier. This happens when an object's objectClass attribute references a class that doesn't exist in the schema, or the class hierarchy got broken. You'll see this error on a specific object, not across the board.
Trigger scenario: You deleted a schema class or attribute but left objects that still reference it. Or a third-party tool messed up the schema.
How to find the orphaned object
Run this command on a healthy DC (preferably the schema master):
repadmin /showrepl * /csv > C:\repl.csv
Open the CSV, look for the object with the error. Note its distinguished name (DN). Then run:
dsquery * <DN> -attr objectClass
You'll see the class list. Compare it to the schema. If one class doesn't exist in CN=Schema,CN=Configuration,DC=domain,DC=com, that's the problem.
Fix it: repair or remove the broken object
- Open ADSI Edit (from Tools in Server Manager). Connect to the
Schemanaming context. - Navigate to
CN=Schema,CN=Configuration,DC=domain,DC=com. Find the missing class — if it's truly gone, you'll need to recreate it using the sameschemaIDGUID. Export the class from a backup DC if you have one. - If the object itself is corrupt and can't be fixed, delete it. Use
dsrm <DN>with care. Make sure you have authoritative restore ready. - After cleanup, run
repadmin /syncall /AdePagain.
Warning: Don't delete objects willy-nilly. If it's a user or group, you'll lose access. Only delete if you're certain it's orphaned and unrecoverable.
Cause #3: Time skew between domain controllers
Yes, this old chestnut. If the source DC's clock is more than 5 minutes off from the receiving DC, the sub-class test can fail because timestamps on schema objects don't line up. This is rare with modern NTP setups but still shows up in labs or misconfigured environments.
Check time sync
Run this on both DCs:
w32tm /query /status
Compare the Last Successful Sync Time and Source. If one DC points to an external source and the other to the domain hierarchy, that's your mismatch.
Fix it: align time
- On the DC with the wrong time, run
w32tm /config /manualpeerlist:<correct-NTP-server> /syncfromflags:manual /reliable:yes /update. Use the PDC emulator as the source. - Then
net stop w32time && net start w32timefollowed byw32tm /resync. - Verify with
w32tm /query /status. The offset should be under a second. - Now retry replication.
I've seen time skew cause weirder errors than 0X000020C7. Always rule it out first if you're in a hurry.
Quick-reference summary
| Cause | Diagnostic command | Fix |
|---|---|---|
| Schema conflict | repadmin /showrepl |
Force schema sync via repadmin /syncall |
| Orphaned object class | dsquery * <DN> -attr objectClass |
Restore missing class or delete orphan |
| Time skew | w32tm /query /status |
Resync NTP and restart time service |
Was this solution helpful?