Active Directory, List FSMO Roles of a Domain Controller (DC) using NtdsUtil.exe

To list the FSMO (Flexible Single Master Operations) Roles of a Microsoft Active Directory Domain Controller (DC) using NtdsUtil.exe:

Start a command prompt (cmd.exe)

Start NtdsUtil.exe
Switch to Roles context
Swtich to Connections context
fsmo maintenance:Connections
Connect to the server
server connections:Connect to server MYDOMAINCONTROLLER
Quit this context
server connections:Quit
Select the so called Operation Targer
fsmo maintenance:Select Operation Target
Now list the Roles for the Server
select operation target:List roles for connected server

that’s it.

To fully automate these steps, you can use this script (just copy paste it in a .bat or .cmd file and execute it with the servername as the first and only parameter)
@echo off
REM Script to dump FSMO role owners on the server designated by %1
if ""=="%1" goto usage
Ntdsutil roles Connections "Connect to server %1" Quit "select Operation Target" "List roles for connected server" Quit Quit Quit
goto done
@echo Please provide the name of a domain controller (i.e. dumpfsmos MYDC)