How to automate Ntdsutil.exe using a script

Article translations Article translations
Article ID: 243267 - View products that this article applies to.
This article was previously published under Q243267
Expand all | Collapse all

SUMMARY

Ntdsutil.exe is a command-line utility that enterprise and domain administrators can use to manage and repair Active Directory. It is a menu-driven tool designed for interactive use, but you can also run it by using scripting and automation.

MORE INFORMATION

To automate Ntdsutil, specify the commands you want to run on the command line as parameters to the Ntdsutil utility. To make parsing easier, each command or parameter is separated by a blank space, and multiple string parameters are enclosed in quotation marks.

For example, the following command demonstrates how Ntdsutil can be controlled through a script to return the list roles held by a domain controller:
c:\ntdsutil r "sel o t" c "co t s servername" q "l r f c s" q q q
Note that the letters in each of the parameters are abbreviated forms of the actual commands found in the Ntdsutil utility. You can obtain the same result by using the unabbreviated form of each command, as in the following example:
c:\ntdsutil roles "select operation target" "connections" "connect to server servername" quit "list roles for connected server" quit quit quit

Properties

Article ID: 243267 - Last Review: March 1, 2007 - Revision: 3.3
APPLIES TO
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
  • Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
  • Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
  • Microsoft Windows 2000 Datacenter Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Server
Keywords: 
kbhowto KB243267

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com