Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


April 2003

Windows Server 2003 Command-Line Utilities

New utilities make scripting easy
RSS
Subscribe to Windows IT Pro | See More Active Directory (AD) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

Microsoft's Windows OSs owe much of their early success to their GUI, a dramatic departure from the text-oriented OSs of the day. I can still remember the effect the Windows 3.0 interface had on me after years of working with 24 * 80 green-screen systems. As the OS has matured, however, Microsoft has realized that a command-line utility is superior to a graphical one in many situations. Automation is the most obvious area. You can use a few command-line utilities and a batch file to create a scheduled task that's just about impossible to create by using a Microsoft Management Console (MMC) snap-in. A rich set of scripting resources, including languages such as VBScript and interfaces such as Active Directory Service Interfaces (ADSI) and Windows Management Instrumentation (WMI), are available to the administrator.

Unfortunately, the average administrator doesn't usually have the time to get comfortable enough with these tools to build useful utilities. Administrators need powerful, already-built utilities that they can throw into a batch file, and they usually need them yesterday. Because administrators need to figure out how to use the programs quickly, decent documentation is important. Consistent syntax across the utilities and informative error messages, both sorely lacking in the past, are important in helping administrators learn utilities quickly.

Microsoft formed Command Line Management, a distinct program office in the Windows Server 2003 development project, to address these administrator needs. Let's take a high-level look at nine significant command-line utilities for Windows 2003 that the Command Line Management program team either created or improved from existing tools.

Preliminaries
One of the goals of the Command Line Management program is to provide administrators with command-line utilities to perform their top management tasks. Not only are these utilities flexible and powerful enough for any administrator to use them to whip up useful scripts, they also improve on previous tools in several much-appreciated ways:

  • The utilities have a standard syntax to reduce the amount of time administrators need to learn each one.
  • You can execute the utilities remotely against a server so that you don't have to log on directly to the console.
  • The utilities support alternate credentials, so they easily work in a secure environment in which you're not typically logged on as a privileged account.
  • The utilities are described in Windows 2003's Help system (search for command line reference) and an upcoming Windows 2003 resource kit. If you want to study these utilities' Help information, you can copy \%windir%\help\ntcmds.chm to your local system and open it there.

As I mentioned earlier, not all of the utilities are new. Many, such as Shutdown, are from the resource kit or Windows 2003 Support Tools, and are now more robust and standardized.

To be proficient with many of these tools, you have to become comfortable with the distinguished name (DN) convention of describing Active Directory (AD) objects. The DN of an AD object describes the object and where it sits in the AD hierarchy. A domain is prefaced with DC= (domain component); an organizational unit (OU), with OU=; and other objects, with CN= (common name). You start the DN with the object itself, then climb to the top of the AD hierarchy. For example, the DN of a DC in the BigTex.net domain would be CN=firstdomcont,OU=domain controllers,DC=bigtex,DC=net. If the DC were in the Sales child domain of BigTex.net, its DN would be CN=firstdomcont,OU=domain controllers,DC=sales,DC=bigtex,DC=net. Remember to enclose the DN in quotes if any of the object names include a space. Don't put a space between the comma and the following object name. I tend to capitalize CN, OU, and DC for clarity, but that practice isn't required.

Be careful if you build command-line utility scripts with anything other than Notepad. By default, Microsoft Word adds smart quotes, replaces double hyphens with em dashes, and uses all sorts of other symbols to make the text look better. As a result, you can spend an hour or two discovering that your command syntax is indeed correct but that the utility is rejecting a few nondisplayable symbols in your code.

The Adprep Utility
Adprep should come first in any discussion of new AD-related command-line utilities because as you might guess from its name, you use Adprep to prepare your existing Windows 2000 AD for upgrade to Windows 2003. If you've planned or installed Microsoft Exchange 2000 Server and Active Directory Connector (ADC) in your enterprise, you'll have worked with an earlier version of Adprep. Although upgrading a Win2K DC to Windows 2003 is straightforward, the Adprep process is a significant new step in this and future upgrades of Windows server OSs.

Adprep has two command switches: /forestprep and /domainprep. You use /forestprep to update the AD schema from the Win2K version 13 to the Windows 2003 version 30. To perform the update, /forestprep does the equivalent of running the Ldifde utility against each of 17 .ldf files (sch14.ldf through sch30.ldf). (For more information about the Ldifde utility, see the Microsoft article "Using LDIFDE to Import and Export Directory Objects to Active Directory" (http://support.microsoft.com/?kbid=237677). Each .ldf file contains schema updates (new object classes or attributes, or changes to existing ones) that Microsoft developers created during the course of the beta program. If you want to see the updates, you can view the .ldf files in the \i386 directory on the Windows 2003 CD-ROM. You run /forestprep once for the entire forest, and its schema updates must have replicated to every DC in the forest before you can continue with the next step: running /domainprep. Figure 1 shows /forestprep updating the schema from version 29 to version 30.

   Previous  [1]  2  3  4  Next 


Reader Comments
I liked the article and the utilities and tried some of the examples. But nowhere can I find any reference to error messages I might receive, especially with DSADD.

For instance: adding an ou as in your first example of the DSADD utility, dsadd failed, A referrel was returned from the server.

What does this mean? I certainly don't know.

Brian April 11, 2004


Hallo, I'd like to help Brain. This error appers when ds-commands syntax is incorrect. In this case 1) check DN of your query or 2) try to add quotes to DN. Hope this helps.

Eugene Sarazhinsky June 18, 2004


I'd like to add users with the DN to be LastName, First. I can't seem to get this work? Also, any way to automatically create the e-mail account at the same time?

MikeWachholz August 12, 2004 (Article Rating: )


it's the best page really a boon for me in this hard time thanks to writer


Anonymous User November 30, 2004


Try Changing CN=users In The DSADD Command To OU=users. That Should Fix The Problem With The Command Returning An Error, Change "users" To Whatever OU You Want To Place The Newly Created User In.

-Schauste

Anonymous User December 03, 2004


Lets say I have an OU called Admin. Within that OU I created 2 more OU's called users and computers. How would I map to a user in the OU=Admin the user is inside the OU=sales.

Ican get everything to work through just having an Admin OU, but for administration purposes I have added a further 2 OU's within an OU.

How would i use say the dsadd command to put a user in an OU within an OU????

Anonymous User December 15, 2004


I thought command line utilities were only for Novell and Unix Administrators, and the big advantage to the Windows GUI was you didn't need command line utilities. How about some real integrated tools that do the job of batching and scripting for use, like ZenWorks.

wglabais January 18, 2005 (Article Rating: )


With the 2 OUs (Nested), the syntax is to list the lowest OU 1st. i.e in the case of Sales inside Admin, type

DSADD computer "<pcname>,OU=Sales,OU=Admin,cn=<DomainName>,cn=<DomainSuffix>"

Hope this helps.
Steve B

Anonymous User February 27, 2005


Something I was taught on a course recently; "Read it Right to Left"

Pete


Anonymous User March 13, 2005 (Article Rating: )


i would like to know when two user use of NAT

how nat underestand the packet that recived,belong to which user?


Anonymous User June 02, 2005 (Article Rating: )


 See More Comments  1   2 

You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

More fun TechEd 2005 Resources

Kevin points out some more TechEd resources ...

What service packs and fixes are available?

...


Active Directory (AD) Whitepapers Sustainable Compliance: How to reconnect compliance, security and business goals

User Provisioning and Access Control

Managing Unix/Linux with Microsoft System Center Operations Manager 2007 Cross Platform Extensions Beta

Related Events Check out our list of Free Email Newsletters!

Active Directory (AD) eBooks Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Keeping Your Business Safe from Attack: Encryption and Certificate Services

Windows 2003: Active Directory Administration Essentials

Related Active Directory (AD) Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.

Job Openings in IT


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

Microsoft Exchange & Windows Connections event returns to Las Vegas Nov 10 - 13
Connections returns to Las Vegas for this exciting event where each attendee will receive SQL Server 2008 standard with 1 CAL. Co-located with Microsoft ASP.NET, SQL Server, and SharePoint Connections with over 250 in-depth sessions.

Free Online Event! Virtualization:Get the Facts!
Register now and attend this free, live in-depth online conference on November 13 and 20, 2008, produced by Windows IT Pro. All registrants are eligible to receive a complimentary one-year digital subscription to Windows IT Pro (a $49.95 value)!

Check Out Hyper-V Video on ITTV
Watch Karen Forster's interview on Hyper-V's performance on ITTV.net.

Ease Your Scripting Pains with the Flexibility of PowerShell!
Join MVP Paul Robichaux on December 11, 2008 at 11:00 AM EDT as he equips you with PowerShell basics in 3 introductory lessons, each followed by a live Q&A session—all on your own computer!

PASS Community Summit 2008 in Seattle on Nov 18-21
The don’t-miss event for Microsoft SQL Server Professionals. Register now and you’ll enjoy top-notch Microsoft and Community speakers and more.



Speed Up Your PC!
Try Diskeeper 2008 with InvisiTasking Free Now!

Get Protected -- Data Protection Manager 2007
Protect your virtualized environment with Data Protection Manager

Agent-less Remote Backup Service, Free 30 Day Trial
Award winning remote backup service at a competitive price with no min GB/month. Sign up Now!

ScriptLogic Cartoon Caption Contest
Submit your caption and you will be entered to win $198.42

List Your Products in Our Technology Resource Directory
Don't miss the chance to post your free listing in this comprehensive directory for IT and developer professionals, powered by Windows IT Pro. But hurry! Deadline ends Oct. 9.
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing