PowerShell Genie

Report FSMO role holders

Script 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Find all five FSMO role holders with Get-ADForest and Get-ADDomain. Read the forest-wide and domain-specific role properties separately.

The script

1PS> Get-ADForest | Select-Object SchemaMaster,DomainNamingMaster; Get-ADDomain | Select-Object PDCEmulator,RIDMaster,InfrastructureMaster

Script reader

Inspect before you run

Inspection only

Inspect the script below. It does not run in this browser.

Inspection only — no command has run.

    Show reference output
    1 PDCEmulator RIDMaster InfrastructureMaster
    2 ----------- --------- --------------------
    3 DC01.example.test DC01.example.test DC01.example.test
    Inspect this example’s structure

    Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

    Get-ADForest | Select-Object SchemaMaster,DomainNamingMaster; Get-ADDomain | Select-Object PDCEmulator,RIDMaster,InfrastructureMaster
    1. Stage 1Get-ADForestPositional values or no named parameters
    2. Stage 2Select-ObjectPositional values or no named parameters
    3. Stage 3Select-ObjectPositional values or no named parameters

      How it works

      Two statements run in sequence. Get-ADForest exposes the forest-wide roles through its SchemaMaster and DomainNamingMaster properties, and Get-ADDomain carries the domain-level roles under PDCEmulator, RIDMaster and InfrastructureMaster. Each Select-Object just reads those properties off the returned object.

      Adapting it

      Assemble a single row instead of two output blocks by wrapping both calls inside one [pscustomobject] literal, which is far easier to file in a runbook or diff against last month's capture.

      Requirements

      ActiveDirectory module.

      If the result is unexpected

      FSMO role owners differ from an old report.

      Roles may have transferred, or the query may be reading a different domain or forest.

      1. Check the domain and forest context and compare the returned role owners with current directory administration records.

      Validate the result

      Each of the five role values resolves to the expected directory server.

      Keep the check reliable

      Include forest, domain and collection time in role-owner reports.

      Primary documentation

      PowerShell objects and pipelines documentation

      Continue
      Genie guideReport FSMO role holders

      Find all five FSMO role holders with Get-ADForest and Get-ADDomain. Read the forest-wide and domain-specific role properties separately.