In this installment of Top 10, I share my favorite Microsoft Windows NT Server 4.0 Resource Kit commands, which I frequently use with my NT command shell scripts. Choosing only 10 commands is difficult because the resource kit provides a rich selection of utilities. (Check out Mark Minasi's This Old Resource Kit columns for more information about resource kit tools.)

10. AutoExNT lets you start the NT command autoexnt.bat when your system boots up, without requiring the user to log on to the system. You use the Instexnt install command to install AutoExNT. To make the service start automatically, go to the Control Panel Services applet and set AutoExNT's startup option to Automatic.

9. AddUsers lets you add and delete user accounts. The command, which you can use for local and remote accounts, reads the account names from a comma-delimited file. Here's how to use AddUsers to add accounts from the accounts.txt file to the system named MyServer:

addusers //MyServer /c accounts.txt

8. IfMember, a useful addition to your logon scripts, lets your scripts take action if a particular user belongs to a specific group. Here's how to use IfMember to determine whether the current user is part of the Administrators group:

ifmember Administrators
if errorlevel 1 echo The user is in the Administrators group

7. LogEvent lets your NT command script write entries into a local or remote NT system's application event log. Here's how to use LogEvent to write an information message:

logevent "Batch Job Completed"

6. Dumpel lets you dump event-log contents to a text file, which you can then process using commands such as For, Findstr, and Munge. Here's how to dump MyServer's system event log to the myevents.txt file:

dumpel -f C:\temp\myevents.txt -s MyServer -l system

5. Munge lets you find and replace strings in text files. Munge is handy because it lets you update your batch files when you need to make mass changes to several scripts. The command uses a script file that contains the from and to strings that will change. Here's how to update the myscript.cmd file using the strings contained in the file changes.txt:

munge changes.txt myscript.cmd

4. Robocopy can copy a single file, multiple files (using wildcards), and full directory trees. Robocopy's ability to retry after network errors makes it superior to NT's standard Copy command. Here's how to copy a directory named scripts from MyServer1 to MyServer2:

robocopy "//MyServer1\scripts" "//MyServer2\scripts"

3. Choice presents a simple set of choices to the end user. Windows 9x includes Choice in its command shell, but the command is missing in NT. Fortunately, its inclusion in the resource kit lets you use Choice in your NT command scripts. Here's a typical example of how to use Choice:

choice Enter Y to Run or N to Cancel

2. Now displays the current date and time. When you use Now in conjunction with redirection, you can log the completion of scripts. Here's how to use Now to write a time-stamped entry into a file named mylog.txt:

now command script completed>mylog.txt

1. Sleep and TimeOut are two of the resource kit's most vital batch file commands. Both commands let your NT command script suspend execution for a set time period (e.g., 60 seconds):

sleep 60
timeout 60

TimeOut resumes execution when the user presses any key.