Home > Samples > Update > May 2003
          Back to associated article: Windows Administration Moves Beyond GUI
  Windows Administration Modes (Sidebar)    
   

Windows offers three modes of administration: GUI, command-line, and scripting. Two forms of administration scripting are supported: basic-batch scripting, which extends command-line administration, and Windows Script Host (WSH) scripts.

Command line. The command line provides direct communication between the user and the OS. Administrators use the command line to invoke OS commands or utility programs and see the output of the command on a console. Administrators particularly like the command line for performing quick one-time administration tasks. For example, when an administrator needs to see if a computer is responding on the network, he can use the ping command to send packets to the computer and watch for the response. Another popular troubleshooting command, ipconfig, shows the configuration of the network interface and allows the renewal or release of an address provided by the Dynamic Host Configuration Protocol. A more obscure command-line utility is cipher, which, when used with a /W parameter, will write random bits over unused disk space to make any files that were deleted from the space unrecoverable by undelete utilities. As powerful as the command line is, it can be cumbersome for administrators to remember the commands and the parameters or flags that control their execution.

Basic batch scripting. A batch file is a text file (with a .bat or .cmd file extension) containing one or more commands that could be issued one at a time on the command line. When an administrator types the file name at the command prompt, the OS typically runs the commands in the batch file sequentially. Batching command lines together into a file makes command-line administration better, and is particularly suited for repetitive tasks, such as automating a workstation’s connection to a file-and-print server’s resources during logon or performing nightly backups. Batch files eliminate the need for the administrator to remember the complex command syntax each time the command is needed—for example, a file named logon.bat could execute a complex sequence of other commands. However, batch files are still limited by both the availability and the functionality of the underlying command-line commands. Also, the Windows batch file language provides limited error handling and flow control (the ability to jump to another part of the batch file under certain conditions, such as the value of a variable).

WSH scripts. WSH scripts are written in a scripting language, such as Microsoft’s Visual Basic Scripting edition (VBScript), and execute under the control of the Windows Script Host. They differ from batch files in that they can invoke the COM interfaces of OS utilities and services, and thus have access to a much larger set of OS functions than are available from the command line. In addition, WSH scripts can invoke the functions of applications that support COM interfaces, such as Microsoft Office. For example, an administrator trying to locate computers running the Microsoft Desktop Engine (MSDE) to patch them against a worm could write a VBScript that locates all computers through the Active Directory Service Interface (ADSI); then, the script could use Windows Management Instrumentation (WMI) to determine which computers have MSDE installed. There are two versions of the WSH: a Windows-based version, Wscript, which provides a property sheet for setting script properties and will display output as message boxes (small windows with an OK button that must be pressed to dismiss the message); and a command-prompt-based version, Cscript, which provides command-line switches for setting script properties and displays output requiring no user intervention on the console.

GUI administration. GUI administration uses the Microsoft Management Console (MMC) and various snap-ins that perform specific sets of administration tasks. For example, right-clicking on the My Computer icon on a desktop and selecting Manage opens an MMC console preconfigured with several snap-ins loaded that allow administration of local users and groups, examination of the event log, and performance of several other management tasks. The MMC and snap-ins work well for complex tasks that the administrator performs relatively rarely, such as adjusting Group Policy settings. For these tasks, the GUI can help the administrator focus on the appropriate users and computers, guiding her through the process without forcing her to remember the parameters of the commands and offering task-specific help information. But for repetitive tasks, such as adding a large number of new users, the GUI console can be very inefficient, and administrators often prefer scripting.