JSI Tip 7401. How can I test a domain controller for a specific FSMO role?
Jerold Schulman
November 2, 2003
1 Min Read
Active Directory defines five FSMO (Flexible Single-Master Operations) roles:
Schema master
Domain naming master
RID master
PDC emulator
Infrastructure
The schema master and domain naming master are per-forest roles. The remaining three, RID master, PDC emulator, and infrastructure master, are per-domain roles.
I have scripted IsRole.bat to test a specified server for a given role.
The syntax for using IsRole.bat is:
call isrole ServerName Role Answer
where:
ServerName is the NetBIOS name of the server, with or without the leading \.Role is the one of the following, and is NOT case sensitive: Schema Domain PDC RID InfrastructureAnswer is a call directed environment variable that will contain a Y if the server holds the Role, a N if the server does NOT hold the Role, or a X if the server could not be contacted.
IsRole.bat contains:
@echo offif ""=="%3" goto usagesetlocal ENABLEDELAYEDEXPANSIONset ans=Nset role=%2set role="%role:"=%"set run=Ntdsutil roles Connections "Connect to server %1" Quit "select Operation Target" "List roles for connected server" Quit Quit Quit for /f "Skip=4 Tokens=1" %%r in ('%run%') do if "!ans!" EQU "N" call :testrole "%%r"endlocal&set %3=%ans%goto :EOF:testroleif "%ans%" EQU "X" goto :EOFif /i %1 EQU "DsBindW" set ans=X&goto :EOFif /i %1 EQU %role% set ans=Ygoto :EOF:usage@echo Syntax: IsRole ServerName Role Answer
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like