Active Directory · Windows PowerShell 5.1
FSMO role holders and domain and forest functional levels
Which domain controllers hold the five FSMO roles, and what are the domain and forest functional levels?
Script
#Requires -Modules ActiveDirectory
# FSMO role holders and functional levels for this domain and its forest. Read-only.
$domain = Get-ADDomain
$forest = Get-ADForest
[pscustomobject]@{
Forest = $forest.Name
ForestMode = "$($forest.ForestMode)"
SchemaMaster = $forest.SchemaMaster
DomainNamingMaster = $forest.DomainNamingMaster
Domain = $domain.DNSRoot
DomainMode = "$($domain.DomainMode)"
PDCEmulator = $domain.PDCEmulator
RIDMaster = $domain.RIDMaster
InfrastructureMaster = $domain.InfrastructureMaster
}
Checked automatically against Microsoft's published cmdlet reference. KBY hasn't run it in your tenant; run it in a test environment first.
Where to run it
A domain-joined machine with the Active Directory module (RSAT) installed.
Reading the output
- PDCEmulator, RIDMaster and InfrastructureMaster are per domain (from Get-ADDomain); SchemaMaster and DomainNamingMaster are per forest (from Get-ADForest).
- Run it in each domain of a multi-domain forest to see every domain's role holders and level.
- A role holder that names a domain controller you have retired is a sign the role was never moved.
Sources
The Microsoft reference page for every cmdlet the script calls, plus the API and product pages behind each permission and caveat.