How to Cheat at Windows System Administration Using Command Line Scripts

In this chapter, we will explore how to perform rudimentary administrative tasks on a Windows computer using the available command-line utilities and commands. We will start with the powerful Net command that provides us with a wide selection of subcommands for performing network-specific tasks as well as general administrative tasks. We will continue with the various commands for troubleshooting potential problems with network settings and discuss how to perform diagnostic tasks. We will focus in particular on commands such as Netstat and NBTStat, and, of course, the ever-popular Ping. We will close the chapter with a discussion of the commands available for communicating with UNIX servers from a Windows computer, either by executing commands remotely or by printing on a UNIX box.
The Net command provides an extremely versatile way to perform any number of tasks on a computer from starting and stopping services, to managing access to shared resources, to sending messages to users on a domain. The syntax of the Net command is as follows:
<b class="bold">Net</b> [ <b class="bold">Accounts</b> <b class="bold">Computer</b> <b class="bold">Config</b> <b class="bold">Continue</b> <b class="bold">File</b> <b class="bold">Group</b> <b class="bold">Help</b> <b class="bold">Helpmsg</b> <b class="bold">Localgroup</b> <b class="bold">Name</b> <b class="bold">Pause</b> <b class="bold">Print</b> <b class="bold">Send</b> <b class="bold">Session</b> <b class="bold">Share</b> <b class="bold">Start</b> <b class="bold">Statistics</b> <b class="bold">Stop</b> <b class="bold">Ttime</b> <b class="bold">Use</b> <b class="bold">User</b> <b class="bold">View</b> ]
The first parameter of this command is the subcommand that will dictate the type of function you want Net to perform. Table 12.1 provides brief descriptions of these subcommands.
| Subcommand | Description |
|---|---|
| net accounts | Updates user accounts, manages passwords, |