Tip

Living dangerously with Ntdsutil commands in Windows Server 2008

Rumor has it that Microsoft is planning to do away with Ntdsutil.exe, a tool that has provided command-line access to a variety of Active Directory functions since Windows 2000. Ntdsutil has been invaluable

Requires Free Membership to View

throughout my experience with troubleshooting AD problems, yet I‘ve found very few admins that use it. This is despite the fact that Windows Server 2008 and R2 include a number of new options that enhance the usefulness of Ntdsutil even further.

Ntdsutil is very powerful, but it’s also dangerous. The problem with some Ntdsutil commands is that they require Active Directory to be taken offline. In Windows 2000 and 2003, this was accomplished by rebooting the domain controller (DC) and starting up in Directory Services Restore Mode (DSRM). This was the only way to run operations like the semantic database checker.

Rebooting a DC (twice) is not a desirable option, however, and it usually requires the operation to be performed during a maintenance window. While not recommended, this is fairly common practice, as booting into DSRM (essentially Safe Mode) takes everything offline.

Fortunately, Windows Server 2008 shipped with a wonderful new option for installing Active Directory as a service that can be taken offline (see Figure 1). Once Active Directory Domain Services (AD DS) is turned off, Ntdsutil can run the semantic database analysis options without a reboot.

Figure 1: Active Directory Domain Services (click to enlarge)

An introduction to Ntdsutil commands
So let’s take a look at the Windows Server 2008 and R2 versions of Ntdsutil and a few of the powerful operations that could save you a support call someday:

  • Metadata cleanup -- permits the deletion of server, site, domain and naming context objects (This is very handy when you have to do a manual demotion of a DC or have some corrupt objects.)
  • Files * -- manages Active Directory database files (This isn’t a real common one, but there are some useful commands here)
  • Group membership evaluation -- dumps security info for a principal
  • Roles -- manages FSMO roles
  • IFM (Install From Media) * -- captures Active Directory snapshots to be used in the dcpromo IFM procedure
  • Semantic database analysis * -- finds and fixes database errors
  • Snapshot -- manages snapshots, including the listing, mounting and un-mounting of snapshots
  • Authoritative restore -- returns domain controllers to a specific point in time

* These operations require Active Directory Domain Services to be stopped.

NOTE: While Active Directory Lightweight Directory Services (AD LDS) has used the dsdbutil and dsmgmt utilities to manage AD LDS instances in the past, Microsoft has actually combined these tools into Ntdsutil. While I won’t discuss the AD LDS options in detail here, it’s important to be aware that all the admin functions are now in AD LDS.

There are several tips and tricks that can help admins navigate the Ntdsutil tool. For starters, the command names can be abbreviated, meaning you just need to enter enough characters to uniquely define the Ntdsutil command. For example, metadata cleanup can be entered as meta cl. Additionally, admins can recall commands using the arrow keys.

Ntdsutil options include Quit, which if selected at any menu level goes up one level, while ^C boots you out of Ntdsutil altogether. Connections will show up in various Ntdsutil commands such as metadata cleanup, as shown in Figure 2. It defines a connection to a specific domain controller. When this command shows up, simply go to the Connections menu and enter:

Connections: Con To Ser <enter DC’s name such as ATL-DC1 >

Operations will then take place on that DC’s copy of Active Directory. You can use the credentials of the logged-in user or specify alternate ones.

Figure 2: Ntdsutil metadata cleanup commands (click to enlarge)

Ntdsutil also has an online help component, as shown in Figure 3. I’ve used this tool many times over the years, and I always enter the question mark (?) at any menu level to get a quick display of the options.

There are also a few changes to the online help feature to note. For instance, the authoritative restore operation now requires a definition of the instance. This is due to how Ntdsutil is used to manage AD LDS partitions. If you receive an error indicating you need to specify the instance, you can use the following command:

Ntdsutil: Activate Partition ntds (or choose the appropriate AD LDS instance to manage).

Figure 3: Ntdsutil help component (click to enlarge)

Part two: A closer look at Ntdsutil commands in Windows 2008

You can follow SearchWindowsServer.com on Twitter @WindowsTT.

ABOUT THE AUTHOR
Gary Olsen is a systems software engineer for Hewlett-Packard in Global Solutions Engineering. He authored Windows 2000: Active Directory Design and Deployment and co-authored Windows Server 2003 on HP ProLiant Servers. Gary is a Microsoft MVP for Directory Services and formerly for Windows File Systems.

This was first published in February 2011

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.