JSI Tip 4675. How do I automate Ntdsutil using a batch file?
Jerold Schulman
January 13, 2002
1 Min Read
Ntdsutil.exe is a menu driven utility designed so that enterprise and domain administrators can manage and repair Active Directory.
Ntdsutil, from the Windows 2000 Support Tools, also has command line capability.
To script Ntdsutil, type the commands, separated by spaces. Multiple string parameters should be enclosed in double-quotes (").
To determine the roles of a given server:
ntdsutil roles "select operation target" "connections" "connect to server " quit "list roles for connected server" quit quit quit
Thankfully, you can abbreviate the commands:
ntdsutil r "sel o t" c "co t s " q "l r f c s" q q q
When I use:
ntdsutil r "sel o t" c "co t s JSI001 " q "l r f c s" q q qit returns:ntdsutil: rfsmo maintenance: sel o tselect operation target: cserver connections: co t s JSI001Binding to JSI001 ...Connected to JSI001 using credentials of locally logged on userserver connections: qselect operation target: l r f c sServer "JSI001" knows about 5 rolesSchema - CN=NTDS Settings,CN=JSI001,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=JSIINC,DC=COMDomain - CN=NTDS Settings,CN=JSI001,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=JSIINC,DC=COMPDC - CN=NTDS Settings,CN=JSI001,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=JSIINC,DC=COMRID - CN=NTDS Settings,CN=JSI001,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=JSIINC,DC=COMInfrastructure - CN=NTDS Settings,CN=JSI001,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=JSIINC,DC=COMselect operation target: qfsmo maintenance: qntdsutil: qDisconnecting from JSI001 ...
See tip 3509 Another way to locate a FSMO role holder.
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