PowerShell Script to Check Active Directory System Requirements

The system requirements for Exchange Server 2013 include the following for Active Directory:

  • Forest and domain functional level of Windows Server 2003 or higher (up to Windows Server 2012 R2 is supported with Exchange Server 2013 SP1 or later)
  • Schema Master running Windows Server 2003 SP2 or later
  • At least one global catalog server in each Active Directory site where Exchange 2013 will be installed that runs Windows Server 2003 SP2 or higher

Using PowerShell we can retrieve all of this information quickly.

Here is a quick and dirty script I wrote that breaks a whole lot of PowerShell “rules” but gets the job done. I’ll probably try and improve it in the near future, but for now it gets me the information I need, which is all I really need any script to do.

Import-Module ActiveDirectory

$forest = Get-ADForest

Write-Host ""
Write-Host -ForeGroundColor Yellow "*** Forest: $($forest.RootDomain) ***"
Write-Host ""
Write-Host "Forest Mode: $($forest.ForestMode)"
Write-Host "Schema Master: $($forest.SchemaMaster)"

$domains = @($forest | Select -ExpandProperty:Domains)

Foreach ($domain in $domains)
{
    Write-Host ""
    Write-Host -ForeGroundColor Yellow "*** Domain: $domain ***"
    Write-Host ""

    $domaindetails = Get-ADDomain $domain

    Write-Host "Domain Mode: $($domaindetails.DomainMode)"
    Write-Host "PDC Emulator: $($domaindetails.PDCEmulator)"
    Write-Host "Infrastructure Master: $($domaindetails.InfrastructureMaster)"
    Write-Host "RID Master: $($domaindetails.RIDMaster)"

}

$domaincontrollers = @(Get-ADDomainController -Filter {IsGlobalCatalog -eq $true})

$gcs = $domaincontrollers | Group-Object -Property:Site,OperatingSystem | Select @{Expression="Name";Label="Site, OS"},Count | Sort Name

Write-Host ""
Write-Host -ForeGroundColor Yellow "*** Global Catalogs by Site/OS ***"

$gcs | ft -auto

The script requires the ActiveDirectory PowerShell module, and in a multi-domain forest should be run in the forest root domain with an admin account that can access each domain.

Example output:

PS C:\Scripts\Exchange2013Planning> .\ADInfo.ps1

*** Forest: exchangeserverpro.net ***

Forest Mode: Windows2003Forest
Schema Master: HO-DC.exchangeserverpro.net

*** Domain: exchangeserverpro.net ***

Domain Mode: Windows2003Domain
PDC Emulator: HO-DC.exchangeserverpro.net
Infrastructure Master: HO-DC.exchangeserverpro.net
RID Master: HO-DC.exchangeserverpro.net

*** Global Catalogs by Site/OS ***

Site, OS                                      Count
--------                                      -----
HeadOffice, Windows Server 2008 R2 Enterprise     1
HeadOffice, Windows Serverr 2008 Standard         1
BranchOffice, Windows Serverr 2008 Standard       1
About Paul Cunningham

Paul is a Microsoft Exchange Server MVP and publisher of Exchange Server Pro. He also holds several Microsoft certifications including for Exchange Server 2007, 2010 and 2013. Connect with Paul on Twitter and Google+.

Leave a Comment

*

We are an Authorized DigiCert™ SSL Partner.