PowerShell Function to Determine the Active Directory FSMO Role Holders via the .NET Framework

Last week I posted a PowerShell function to determine what Active Directory domain controllers held the FSMO roles for one or more domains and forests. That particular function used the Get-ADDomain and Get-ADForest cmdlets which are part of the Active Directory PowerShell module. As it so happens, a friend of mine, Shay Levy who is a PowerShell MVP posted an article on PowerShell Magazine that uses a couple of one liners that use the .NET Framework to return the FSMO role holders.

I’m not a .NET guy, but this started me thinking that there was probably a way with the .NET Framework to figure out where the FSMO roles were based on a given domain instead of the current one.

I decided to retro-fit my function to use the .NET Framework Class that Shay was using, but I figured out a different static method (I think that’s what it’s called, but correct me if I’m wrong). This other static method would indeed return the FSMO role holders based on a given domain name.

This script can be downloaded from the TechNet Script Repository.


I’ll be at the PowerShell Summit North America 2013 next week! Don’t forget about the Scripting Games that also begin next week.



  1. Wojtek

    please tell me what is differents between Microsoft.ActiveDirectory.Management.ADForest (get-adforest) and system.directoryservices.activedirectory.forest ?


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: