Microsoft released several Security Updates (SUs) for Microsoft Exchange Server to address vulnerabilities. Due to…
Check Exchange Schema version with PowerShell
You want to know if your Active Directory (AD) is up to date. For example, you want to check and verify the Exchange 2013/2016/2019 schema version before and after an upgrade to the newer Exchange Server version. In this article, you will learn how to check the Exchange schema version with PowerShell.
Table of contents
Why check Exchange schema version information
It’s good to check and verify the Exchange schema version, for example:
- Before installing Exchange Cumulative Update
- Before installing a new Exchange Server
- After preparing Active Directory and domains for Exchange Server
Get Exchange schema version with Get-ADversions PowerShell script
Download the script Get-ADversions.ps1 and save it in the C:\scripts\ folder.
Ensure that the file is unblocked to prevent any errors when running the script. Read more in the article Not digitally signed error when running PowerShell script.
Another option is to copy and paste the below code into Notepad. Give it the name Get-ADversions.ps1 and place it in the C:\scripts folder.
# Exchange Schema Version
$sc = (Get-ADRootDSE).SchemaNamingContext
$ob = "CN=ms-Exch-Schema-Version-Pt," + $sc
Write-Output "RangeUpper: $((Get-ADObject $ob -pr rangeUpper).rangeUpper)"
# Exchange Object Version (domain)
$dc = (Get-ADRootDSE).DefaultNamingContext
$ob = "CN=Microsoft Exchange System Objects," + $dc
Write-Output "ObjectVersion (Default): $((Get-ADObject $ob -pr objectVersion).objectVersion)"
# Exchange Object Version (forest)
$cc = (Get-ADRootDSE).ConfigurationNamingContext
$fl = "(objectClass=msExchOrganizationContainer)"
Write-Output "ObjectVersion (Configuration): $((Get-ADObject -LDAPFilter $fl -SearchBase $cc -pr objectVersion).objectVersion)"
Run PowerShell as administrator. Make sure that you set the Execution Policy to Unrestricted. If you don’t, the script will not run.
Set-ExecutionPolicy Unrestricted -Force
Now run the Get-ADversions.ps1 PowerShell script.
C:\scripts\.\Get-ADversions.ps1
After running the PowerShell script, you will see an output of the Active Directory versions:
- RangeUpper: 17003
- ObjectVersion (Default): 13242
- ObjectVersion (Configuration): 16759
The next step is to check and verify the schema.
Check and verify Active Directory versions
How to confirm the Exchange Active Directory versions? Visit the page Exchange schema versions to get a list of the object versions.
We can confirm that Exchange 2019 schema version is up to date for Exchange 2019 CU11.
Conclusion
You learned how to check and verify the Exchange schema version with PowerShell. Run the Get-ADversions.ps1 PowerShell script and check if the Active Directory versions are correctly shown.
Did you enjoy this article? If so, you may like Exchange Server in DMZ or LAN network. Don’t forget to follow us and share this article.
what if you get different versions for each object?
You have to Prepare Active Directory and domains for Exchange Server.
An excellent way is to follow the below articles and have an up-to-date Exchange Server:
– Install Exchange Cumulative Update.
– Install Exchange Security Update
if am to upgrade from exchange cu20 to Cu22, do i need to use CU21 installation file to extend the schema or i can leverage on CU22 as CU22 required no schema upgrade
You can upgrade from CU20 to CU22 and skip CU21. Upgrading from Exchange Server 2016 CU20 to CU22 requires an Exchange Schema update.
Check the Exchange Schema versions table.
Dear Ali
How are you?
Thanks for your Article.
i have question about that power shell scrip (Get-ADversions.ps1 ).
Why this script work only on windows server 2016 and not work in windows server 2019?
Hi Mahdi,
You’re welcome.
It works fine on Windows Server 2019. Do you get an error, or what is not working? Make sure to copy and run each command. Another way is to download the Get-ADversions.ps1 PowerShell script and run it from PowerShell.
Can’t explain why for Exchange Object Version (domain) “CN=Microsoft Exchange System Objects” I get 6936 which apparently corresponds to Exchange 2003.
I transitioned successfully from 2003 to 2010 and from 2010 to 2016.
No issue just wondering if I need to do anything or leave it like this?!
Try the following. Mount the Exchange CU ISO file and run Command Prompt as administrator. Browse to the drive and run the command:
Setup.exe /IAcceptExchangeServerLicenseTerms /PrepareAllDomains