#PSTip Discovering Active Directory FSMO Role Holders using PowerShell

Note: This tip requires PowerShell 2.0 or above.

Active Directory defines five FSMO roles:

  • Schema master
  • Domain naming master
  • RID master
  • PDC master
  • Infrastructure master

The first two: schema master and the domain naming master are per-forest roles. There can be only one of each per forest. The other three: RID master, PDC master, and the infrastructure master are per-domain roles. Each domain has its own RID master, PDC master, and infrastructure master.

There are numerous ways and tools to help you get the information, including the PowerShell AD module. With the following code, you can get the forest and domain role holders of the  current user using PowerShell only.

[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() | Select-Object *owner
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest() | Select-Object *owner

About the author: Shay Levy

Shay Levy is a Co-founder and editor of the PowerShell Magazine. He is a multiple-year recipient of the Microsoft MVP award, and a Microsoft Certified Trainer (MCT). Shay often covers PowerShell related topics on his blog and you can also follow him on Twitter at @ShayLevy

Related Posts

%d bloggers like this: