Active Directory Schema Versions

With the release of Windows Server 2016 its time to update my schema versions script

$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}
    56{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2012"; break}
    69{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2012 R2"; break}
    87{"{0,25} " -f "Schema Version $($de.ObjectVersion) = Windows 2016"; break}
    default{"{0,25} {1,2} " -f "Unknown Schema Version", $($de.ObjectVersion); break}
}

The script uses the GetCurrentSchema static method on System.DirectoryServices.ActiveDirectory.ActiveDirectorySchema. Derives a directory entry and uses the ObjectVersion to determine the corresponding Windows Server version.

Advertisements
This entry was posted in PowerShell and Active Directory. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s