AD Attribute Not Defined for Class (0X0000207D) Fix
You get this when trying to set an attribute on an AD object that doesn't support it. Usually an LDAP modify or PowerShell script gone wrong. Schema mismatch is the culprit.
You'll hit error 0X0000207D when you try to write an attribute to an Active Directory object that doesn't allow it. Happens all the time with PowerShell scripts that blindly set attributes on user objects, or when you're migrating from an old schema and your LDAP modify command targets the wrong objectClass. I've seen it most often with custom attributes — someone extends the schema with a new attribute for inetOrgPerson, then tries to apply it to a plain user object. The schema says no.
Root Cause
The error's pretty straightforward: the attribute you're trying to set isn't listed in the mustContain or mayContain list for that object's class. Active Directory validates every write against the schema. If the attribute doesn't belong to the class or any parent class, it throws 0X0000207D. Common triggers:
- Using
Set-ADUserwith a custom attribute that's only attached toorganizationalPerson, notuser - LDAP modify operations via scripts that don't check the object's
objectClassfirst - Application trying to write a multi-valued attribute onto a single-valued attribute slot
The Fix
- Identify the attribute and object class
Run this PowerShell to see what classes allow the attribute:
Get-ADObject -Filter {objectClass -eq 'attributeSchema'} -Properties * | Where-Object {$_.ldapDisplayName -eq 'YOUR_ATTRIBUTE'} | Select-Object objectClassCategory, systemMayContain, systemMustContain, mayContain, mustContain
- Check what class the target object actually is
Don't guess. Use ADSI Edit or PowerShell:
Get-ADObject -Identity 'CN=user,OU=Users,DC=domain,DC=com' -Properties objectClass
- If the attribute isn't in the class's allowed list
You've got two options:
- Add the attribute to the class'smayContainlist via schema modification (dangerous — make sure you understand schema changes)
- Change your script to target a different attribute or class
- For temporary testing, append a dummy class
You can add an auxiliary class that contains the attribute to the object. This works in a pinch:
Set-ADObject -Identity 'CN=user,OU=Users,DC=domain,DC=com' -Add @{objectClass='auxClassContainingYourAttribute'}
- Refresh the schema cache
After any schema changes, you need to reload the schema cache on the domain controller you're hitting. Otherwise your write still fails. Do this:
repadmin /syncall /AdeP
# Or on the DC itself:
dsrcv /refreshschema
- Retry your operation
Wait 2-3 minutes for replication, then run whatever gave you the error again.
If It Still Fails
Two things I see people skip:
- Replication delay — even after
repadmin, changes take time especially in multi-site environments. Check event log for 2089 errors (replication failures). - Wrong DC — you might be hitting a different DC that hasn't received the schema update. Use
$env:LOGONSERVERor specify-Serverin your PowerShell cmdlet.
Pro tip: If you're in a hurry and just need the operation to work, change the script to use attributeValue on a different attribute that the class already supports. I've done this more times than I care to admit for emergency fixes. Then fix the schema later.
One last thing — verify the attribute isn't marked as systemOnly. If it is, only the system can write it. Check that with:
Get-ADObject -Filter {objectClass -eq 'attributeSchema' -and ldapDisplayName -eq 'YOUR_ATTRIBUTE'} -Properties systemOnly | fl systemOnly
If it returns True, you're out of luck unless you're running as SYSTEM on a DC. In that case, you're probably looking at a different problem.
Was this solution helpful?