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

  1. Open ADSIEDIT.msc
  2. Connect to the configuration partition
    KB10111 - PS: Enumerate Exchange relevant versions in forest
  3. Go to the container: Services⁄Microsoft Exchange and edit the properties of you Exchange organization
    KB10111 - PS: Enumerate Exchange relevant versions in forest
  4. Scroll down to the field "objectVersion"
    KB10111 - PS: Enumerate Exchange relevant versions in forest

rangeUpper in AD DS Schema

  1. Open ADSIEDIT.msc
  2. Connect to the Schema partition
  3. Navigate to object "CN=ms-Exch-Schema-Version-Pt"
    KB10111 - PS: Enumerate Exchange relevant versions in forest
  4. Select the properties of the object
    KB10111 - PS: Enumerate Exchange relevant versions in forest
  5. Scroll to the field "rangeUpper"
    KB10111 - PS: Enumerate Exchange relevant versions in forest

objectVersion in the Domain

  1. Open "Active Directory Users and Computers"
  2. Enabled "Advanced Features" in the "View" menue
    KB10111 - PS: Enumerate Exchange relevant versions in forest
  3. Select the properties of "Microsoft Exchange System Objects"
    KB10111 - PS: Enumerate Exchange relevant versions in forest
  4. Scroll to the field "objectVersion"
    KB10111 - PS: Enumerate Exchange relevant versions in forest

List of correct versions:


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)
}

	

>> syntax highlighting powered by highlight.js