Forum Discussion
Active Directory Schema Attributes vs Version
For application compatibility, I wouldn't hard-code assumptions such as “Windows Server 2019 means attribute X exists.”
The forest's schema version is stored in objectVersion on the schema container. For reference, Microsoft lists Server 2008 R2 as schema 47, Server 2016 as 87, Server 2019/2022 as 88 and Server 2025 as 91.
You can check the forest schema version with PowerShell:
$schema = (Get-ADRootDSE).schemaNamingContext
Get-ADObject $schema -Properties objectVersion |
Select-Object objectVersion
But for software, an even safer approach is to detect the attribute itself:
$schema = (Get-ADRootDSE).schemaNamingContext
Get-ADObject `
-SearchBase $schema `
-LDAPFilter '(lDAPDisplayName=department)'
The schema contains the authoritative definitions of the object classes and attributes available in that forest.
That approach also handles environments where the schema has been extended by Exchange or another product. Check capability directly rather than assuming availability only from the Windows Server version