PowerShell: Check Exchange Server Active Directory versions
Background
Whenever someone is preparing AD for Exchange manually, they would have come across this article's Prepare Active Directory and domains section 'How do you know this worked?' for sure. It shows the GUI options using ADSI Editor to identify the version info about Exchange on AD.
Also, the article lists out the warning as below.
Warning:
*Never change values in ADSI Edit unless you're told to do so by Microsoft support. Changing values in ADSI Edit can cause irreparable harm to your Exchange organization and Active Directory.
*
Now in this era when everything can be done in PowerShell why not leverage that here as well. Ian Farr [MSFT] on his blog has a similar one-liner.
So here are three one-liners in PowerShell for AD. WindowsServer2012R2 and few recent ones with PS v3 modules would auto-load, others just add this to the top: Import-Module ActiveDirectory
The Code
#How to know AD is prepared:
Get-ADObject "CN=ms-Exch-Schema-Version-Pt,$((Get-ADRootDSE).schemaNamingContext)" -Property Rangeupper
Get-ADObject "CN=Microsoft Exchange System Objects,$((Get-ADRootDSE).defaultNamingContext)" -Property objectVersion
Get-ADObject (dir "AD:\CN=Microsoft Exchange,CN=Services,$((Get-ADRootDSE).configurationNamingContext)").DistinguishedName -Property objectVersion
#Another way to get config version: Exact same result
Get-ADObject ([ADSI]"LDAP://CN=Microsoft Exchange,CN=Services,$((Get-ADRootDSE).configurationNamingContext)").psbase.children.distinguishedName -Property objectVersion
The code is generic and would work for any environment, any newer DC versions (2012 for sure), no need to type in or remember your ExchangeOrganizationName as well, the script will find it for you.
Once you have the values just compare it with Exchange 2016 Active Directory versions Table.
Test Run:
PS > Get-ADObject "CN=ms-Exch-Schema-Version-Pt,$((Get-ADRootDSE).schemaNamingContext)" -
Property Rangeupper
DistinguishedName : CN=ms-Exch-Schema-Version-Pt,CN=Schema,CN=Configuration,DC=Bluehill,DC=com
Name : ms-Exch-Schema-Version-Pt
ObjectClass : attributeSchema
ObjectGUID : b2feec43-bdb1-4b54-b598-1358e9891567
Rangeupper : 15317
PS > Get-ADObject "CN=Microsoft Exchange System Objects,$((Get-ADRootDSE).defaultNamingCo
ntext)" -Property objectVersion
DistinguishedName : CN=Microsoft Exchange System Objects,DC=Bluehill,DC=com
Name : Microsoft Exchange System Objects
ObjectClass : msExchSystemObjectsContainer
ObjectGUID : 0d7ac511-3c1e-46df-8a4f-4fad2ab253b5
objectVersion : 13236
PS > Get-ADObject (dir "AD:\CN=Microsoft Exchange,CN=Services,$((Get-ADRootDSE).configura
tionNamingContext)").DistinguishedName -Property objectVersion
DistinguishedName : CN=Bluehill,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Bluehill,DC=com
Name : Bluehill
ObjectClass : msExchOrganizationContainer
ObjectGUID : 95ecab8d-ee0f-4a9d-b5e1-e22e3a31912d
objectVersion : 16210
And of course, once full installation is over you can check Exchange version using this: in EMS
Get-ExchangeServer | fl Name,Site,ServerRole,Edition,AdminDisplayVersion
Name : EX2016
Site : Bluehill.com/Configuration/Sites/Default-First-Site-Name
ServerRole : Mailbox, ClientAccess
Edition : StandardEvaluation
AdminDisplayVersion : Version 15.1 (Build 225.17)
By now guess you all know that this article shows the installation of Exchange 2016 RTM. So why not start with something new.
References
- Exchange 2016 Active Directory versions:
- One-Liner: Active Directory Schema Version:
- Get your Exchange organization name: