The good ol’ days of DOS die hard for some of us. I still use a command line for as many of my administrative tasks as I can. Windows NT’s browser service, along with the additional overhead of using a GUI, often makes me fall asleep and forget what I was doing in the first place. When I found myself connecting to terminal server sessions, only to open up a command prompt, I knew I needed a better method. I found it in the Windows 2000 Server Resource Kit.
Windows 2000 offers quite a few GUI-based remote administration capabilities, such as terminal services and the Microsoft Management Console (MMC). (Deb Shinder’s article, “Four must-know remote administration services in Windows 2000 Pro," is an excellent overview.)
When it comes to command-line utilities for remote administration, I’ve found the default installation of Windows 2000 to be somewhat lacking. This is where the Windows 2000 Server Resource Kit really shines.
One of the more common administrative tasks when working with Windows 2000 networks is dealing with services. How many times have I opened up the Services snap-in, connected to another computer, waited a few minutes, and then clicked a button to restart a service? There are a couple of great tools specifically aimed at streamlining this task.
The SC.EXE command-line utility allows you to start, stop, query, and add descriptions to services on remote computers, along with several other advanced options. Here are some examples using this utility:
- SC \\MyServer STOP MyService
- SC \\MyServer QUERY MyService
- SC \\MyServer START MyService
- SC \\MyServer DESCRIPTION MyService MyDescription
The NETSVC.EXE command-line utility is very similar to SC.EXE but offers some slightly different functionality. One of these is the ability to list all the services on a specific computer. Here are some examples:
- NETSVC MyService \\MyServer /STOP
- NETSVC MyService \\MyServer /QUERY
- NETSVC MyService \\MyServer /START
- NETSVC \\MyServer /LIST
If one of your common administrative tasks includes killing runaway processes, the Resource Kit comes with a special service that allows you to do this on remote computers.
Using the RKILL.EXE utility, you can install the RKILLSRV.EXE service on a remote computer, view all the processes running on that computer, and kill a process on that computer. For example:
- RKILL /INSTALL \\MyServer
- RKILL /VIEW \\MyServer
- RKILL /KILL \\MyServer MyProcessID
- RKILL /NKILL \\MyServer MyProcess.exe
Remote command prompt
Sometimes you just don’t want to remember all those other utilities; all you want is a single command interface that lets you do whatever you want on the remote computer. If you just want a command prompt, as if you were sitting at the console, these next three utilities are for you.
Wait a minute—isn’t TELNET.EXE a UNIX utility? Apparently it’s so popular with command-line gurus that Microsoft not only built this into Windows 2000 but also got rid of the GUI client that existed in previous versions of Windows. The telnet service is installed, but not started, by default. If you telnet into a server using the default port, you’ll get a command prompt for the remote computer. If you telnet into a server on another port, you can communicate directly with the service operating on that port. Connect to port 80 and issue HTTP commands to your IIS server. Or connect to port 25 and issue SMTP commands to your Exchange/SMTP server. Some examples follow:
- TELNET MyServer
- TELNET MyServer 80
- TELNET MyServer 25
Once the RCMDSVC.EXE service is installed on a remote computer, you can open a command prompt on that computer with this utility. In functionality, it is very similar to telnet. One big difference is that you can use this command to execute a single command on the remote computer, rather than opening the command prompt, typing your command, and then typing exit. You could use this type of functionality in an automated script, for example. A couple of examples are as follows:
- RCMD \\MyServer
- RCMD \\MyServer NET START MyService
While TELNET and RCMD both offer the capability of a full command prompt on a remote computer, this utility provides one feature that makes it my favorite. RCLIENT has the ability to utilize the video memory on the remote computer, making it possible to run certain DOS applications, like EDIT.COM. One major drawback to the first two utilities is that you have no means to edit text files on the remote computer. Found in the RCONSOLE directory of the Resource Kit, the following commands can be issued to install and connect to this service:
- RSETUP MyServer
- RCLIENT MyServer
Other utilities worth mentioning
There are two more utilities that I have found to be extremely useful in the day-to-day administration of Windows 2000 servers.
UPTIME.EXE is a very simple utility but provides a key piece of information that administrators want to know: “How long has my server been up and running?” Example: UPTIME \\MyServer
SHUTDOWN.EXE is a can’t-live-without utility. Use this utility to shut down and/or restart your servers or workstations (NT-based only). You can specify a wait-time before execution and you can force-close any open files. This single command can be used with a GUI or from a command-line. Examples:
- SHUTDOWN \\MyServer /R /T:60 /C
More resource kit utilities
If you haven’t already, spend some time checking out the resource kit. Some of the tools are available for free, but the full package must be purchased separately from Microsoft. For more information, visit Microsoft. Isn’t it time you took command of your servers?