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.

Download the script from Github

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>.Get-ADInfo.ps1
*** Forest: exchangeserverpro.net ***

Forest Mode: Windows2003Forest
Schema Master: S1DC1.exchangeserverpro.net
Domain Naming Master: S1DC1.exchangeserverpro.net
UPN Suffixes: esp.local

*** Domain: exchangeserverpro.net ***

NetBIOS Name: ESPNET
Domain Mode: Windows2003Domain
PDC Emulator: S1DC1.exchangeserverpro.net
Infrastructure Master: S1DC1.exchangeserverpro.net
RID Master: S1DC1.exchangeserverpro.net

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

Site, OS                                       Count
--------                                       -----
DataCenter1, Windows Server 2012 R2 Datacenter     1

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. austin

    Does not work. Sadly I am not sure why.

    At C:Get-ADInfo.ps1:41 char:4
    + 39 $htmlreport = $null
    + ~~~~~~~~~~~
    Unexpected token ‘$htmlreport’ in expression or statement.
    At C:Get-ADInfo.ps1:42 char:4
    + 40 $htmlbody = $null
    + ~~~~~~~~~
    Unexpected token ‘$htmlbody’ in expression or statement.
    At C:Get-ADInfo.ps1:43 char:4
    + 41 $htmlfile = “ADInfo.html”
    + ~~~~~~~~~
    Unexpected token ‘$htmlfile’ in expression or statement.
    At C:Get-ADInfo.ps1:44 char:4
    + 42 $spacer = “”
    + ~~~~~~~
    Unexpected token ‘$spacer’ in expression or statement.
    At C:Get-ADInfo.ps1:47 char:4
    + 44 Import-Module ActiveDirectory
    + ~~~~~~~~~~~~~
    Unexpected token ‘Import-Module’ in expression or statement.
    At C:Get-ADInfo.ps1:55 char:4
    + 50 $forest = Get-ADForest
    + ~~~~~~~
    Unexpected token ‘$forest’ in expression or statement.
    At C:Get-ADInfo.ps1:58 char:4
    + 52 $htmlbody += “Forest Details”
    + ~~~~~~~~~
    Unexpected token ‘$htmlbody’ in expression or statement.
    At C:Get-ADInfo.ps1:61 char:4
    + 54 $forestinfo = New-Object PSObject
    + ~~~~~~~~~~~
    Unexpected token ‘$forestinfo’ in expression or statement.
    At C:Get-ADInfo.ps1:64 char:4
    + 56 Write-Host -ForeGroundColor Yellow “*** Forest: $($forest.RootDomain) ***”
    + ~~~~~~~~~~
    Unexpected token ‘Write-Host’ in expression or statement.
    At C:Get-ADInfo.ps1:65 char:4
    + 57 Write-Host “”
    + ~~~~~~~~~~
    Unexpected token ‘Write-Host’ in expression or statement.
    Not all parse errors were reported. Correct the reported errors and try again.
    + CategoryInfo : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : UnexpectedToken

    1. Avatar photo
      1. Sandy Rodrigues

        getting this error

        Unexpected token ‘htmlreport’ in expression or statement.
        At C:\Users\XXXXXX\Desktop\adinfo.ps1:35 char:15
        + 33 $htmlreport <<<< = $null
        + CategoryInfo : ParserError: (htmlreport:String) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : UnexpectedToken

  2. David Ray

    It seems like Microsoft did something is some update to cause Get-ADDomainContoller -Filter to not work as expected (like it used to).
    I got this script to work by replacing
    Line 117: $domaincontrollers =@(Get-ADDomainController -Filter {IsGlobalCatalog -eq $true})
    with
    Line 117: $domaincontrollers = @(Get-ADForest | Select -ExpandProperty GlobalCatalogs | foreach{Get-ADDomainController $_})

    Different way to get the same information.

Leave a Reply