Monthly Archive


Get Schema version

Just for a change I thought we’d have a look at something different.  The schema is often treated as a big scary thing that we shouldn’t mess with. Many organisations don’t like upgrading the schema.

Lets start by looking at the schema version. This can be easily read but understanding what the version numbers mean is a bit more work

$sch = [System.DirectoryServices.ActiveDirectory.ActiveDirectorySchema]::GetCurrentSchema()            
$de = $sch.GetDirectoryEntry()            
switch ($de.ObjectVersion)            
 13{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2000"; break}            
 30{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2003"; break}            
 31{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2003 R2"; break}            
 44{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2008"; break}            
 47{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2008 R2"; break}            
 default{"{0,25} {1,2} " -f "Unknown Schema Version", $($de.ObjectVersion); break}            

Get the current schema using the GetCurrentSchema() method of System.DirectoryServices.ActiveDirectory.ActiveDirectorySchema. Convert it to a directory entry and read the objectversion attribute.

The distinguished name we are working with is CN=Schema,CN=Configuration,DC=Manticore,DC=org so we can use all of our techniques as you’ll see.

Leave a Reply