KB10111 - PS: Enumerate Exchange relevant versions in forest
General description
This article describes how to read Exchange relevant version information from Active Directory. It contains a small Power Shell script, which collects the required values in a whole forest.
Determine the version manually
Configuration objectVersion
- Open ADSIEDIT.msc
- Connect to the configuration partition
- Go to the container: Services⁄Microsoft Exchange and edit the properties of you Exchange organization
- Scroll down to the field "objectVersion"
rangeUpper in AD DS Schema
- Open ADSIEDIT.msc
- Connect to the Schema partition
- Navigate to object "CN=ms-Exch-Schema-Version-Pt"
- Select the properties of the object
- Scroll to the field "rangeUpper"
objectVersion in the Domain
- Open "Active Directory Users and Computers"
- Enabled "Advanced Features" in the "View" menue
- Select the properties of "Microsoft Exchange System Objects"
- Scroll to the field "objectVersion"
List of correct versions:
- Exchange 2016: >> technet article
Script code:
##------------------------------------------------------------------------------------------------
##
## Get-ExchangeADDSVersionInformation.ps1
##
## Version 1.0.2
##
## (c) 2016 Martin Mueller
## www.sh-soft.com
##
## Licence: Feel free to use and redistribute this script!
##
##------------------------------------------------------------------------------------------------
if (-Not (Get-Module -Name ActiveDirectory)) {
Import-Module ActiveDirectory
}
$ForestDN = Get-ADForest | Select-Object -ExpandProperty RootDomain | Get-ADDomain | Select-Object -ExpandProperty DistinguishedName
$ConfigurationDN = "CN=Configuration,"+$ForestDN
$ExcontainerDN = "CN=Microsoft Exchange,CN=Services,"+$ConfigurationDN
$OrgDN = Get-ChildItem -Path "AD:\$ExcontainerDN" | Where-Object {$_.ObjectClass -eq "msExchOrganizationContainer"} | Select-Object -ExpandProperty DistinguishedName
$SchemaObjectDN = "CN=ms-Exch-Schema-Version-Pt,CN=Schema,"+$ConfigurationDN
Write-Host -ForegroundColor Green "Enumerating Exchange version information in forest: "-NoNewline
Write-Host (Get-ADForest | Select-Object -ExpandProperty RootDomain)
#WriteOrgName to console
Write-Host -ForegroundColor Yellow "Exchange Organization Name: " -NoNewline
Write-Host (Get-ChildItem -Path "AD:\$ExcontainerDN" | Where-Object {$_.ObjectClass -eq "msExchOrganizationContainer"} | Select-Object -ExpandProperty Name)
#Forest wide configuration
$ConfigurationObjectVersion = Get-ADObject -Identity "$OrgDN" -Properties objectVersion | Select-Object -ExpandProperty objectVersion
$RangeUpperVersion = Get-ADObject -Identity "$SchemaObjectDN" -Properties rangeUpper | Select-Object -ExpandProperty rangeUpper
#Domain Version
$DomainsInForest = Get-ADForest | Select-Object -ExpandProperty Domains
# Write info to console
Write-Host ""
Write-Host -ForegroundColor Yellow "Version Information:"
Write-Host ""
Write-Host -ForegroundColor Yellow "objectVersion in Configuration partition: " -NoNewline
Write-Host $ConfigurationObjectVersion
Write-Host ""
Write-Host -ForegroundColor Yellow "rangeUpper in Schema partition: " -NoNewline
Write-Host $RangeUpperVersion
Write-Host ""
Write-Host -ForegroundColor Yellow "objectVersion of each domains 'Exchange System Objects' container:"
foreach ($Domain in $DomainsInForest) {
$DomainDetails = Get-ADDomain -Identity $Domain | Select-Object -Property PDCEmulator, DistinguishedName
Write-Host -ForegroundColor Yellow " Domain: " -NoNewline
Write-Host $Domain
Write-Host -ForegroundColor Yellow " queried DC: " -NoNewline
Write-Host $DomainDetails.PDCEmulator
Write-Host -ForegroundColor Yellow " objectVersion: " -NoNewline
$ExchangeDNinDomain = "CN=Microsoft Exchange System Objects,"+$DomainDetails.DistinguishedName
Write-Host (Get-ADObject -Identity "$ExchangeDNinDomain" -Server $DomainDetails.PDCEmulator -Properties objectVersion | Select-Object -ExpandProperty objectVersion)
}