System-management commands help the system administrator keep the system running smoothly on a day-to-day basis. They include disk management, process management, password management, user and group management, and service management.
System administrators must keep track of how disks are being used and how they are performing so that they can maintain them and add disks if necessary. Windows Server 2003 provides both graphical and command-line functions that assist in these tasks. The graphical disk management facilities were discussed in Chapter 14, "Disk Management." In the following sections, we describe their command-line counterparts.
The chkdsk command can be used by the Administrators group and provides the status of the disk as well as a list of errors. The command's options allow these errors to be corrected. For errors to be displayed and corrected accurately, the drive being checked should be locked; this means that no files are open and in use. If the drive is not locked, chkdsk offers the user the option of automatically executing the command at the next reboot. In this instance, any errors are automatically corrected.
The syntax for chkdsk is
chkdsk [drive:][[path\]filename] [options]
Table A.71 lists the options available with the chkdsk command.
Option |
Description |
---|---|
/f |
Fixes the errors found on the disk. The disk must be locked; if not, it will be checked at the next reboot. |
/v |
Displays the name of each file as it is checked. |
/r |
Identifies bad sectors, then tries to recover readable information. |
Running chkdsk without parameters or options displays a status report for the current disk drive. The drive: parameter is the letter designation for the drive you want checked. For FAT file system volumes, a path\filename parameter can be entered to designate one or more files to be checked for fragmentation. Wildcard characters can be used to specify multiple files.
The chkntfs command determines when or if automatic system checking is to occur on FAT, FAT32, or NTFS volumes when the computer boots. It is launched from the command prompt with the following syntax:
chkntfs [/t[:time]] [/d][/x] [/c] volume: [...]
Table A.72 lists the options available with the chkntfs command.
The following is an example of the chkntfs command:
chkntfs /d
restores the default settings, and
chkntfs /x c: d: e:
excludes the c, d, and e volumes from checking.
Option |
Description |
---|---|
/c |
Checks the specified volume at boot time. |
/d |
Resets the default settings, except the countdown time for checking. |
/t |
Sets the countdown time for scheduled checking. |
/x |
Does not check the specified volumes. |
Option |
Qualifier |
Description |
---|---|---|
-y |
e |
Flags the disk-performance counters to start the next time the system is rebooted. These counters continue to collect data until they are turned off using the -n option. Use the e qualifier only to measure the performance of the drives in a striped disk set. To revert to the standard performance measurements, execute the command again with just the -y option. |
-n |
Stops gathering the disk performance information after the next reboot. |
|
\\computername |
Enters the name of the computer on which to start or stop the disk-performance counters. When the -y or -n parameters are omitted, this option displays whether the performance counters have been activated for the specified computer. |
The diskperf command starts and stops the system disk performance counters. It works in conjunction with the Performance Monitor (Start Programs Administrative Tools Performance Monitor), and its syntax is
diskperf [-y[e] | -n] [\\computername]
When diskperf is executed without parameters, it displays whether the disk performance counters have been activated. The other options are described in Table A.73.
Process management governs the running of processes and applications on the local system. It includes such tasks as scheduling programs, terminating applications and processes, displaying active applications and processes, and monitoring the performance of processes and the local system.
The at command works in conjunction with the Schedule service and enables commands and programs to be executed in the background at a predefined date and time. The user executing at should be a member of the Administrators group on the local system. (The Schedule service is started by selecting Start Settings Control Panel Services. In the Services window, select Schedule and click Start.)
The two syntax formats for the at command are
at [\\computername] [[id] [/delete [/yes]]] at [\\computername] time [/interactive] [/every:date | /next:date] "command"
When at is executed without options, it performs two functions. First, it displays a list of the scheduled commands with their status, identification number, and day and time to be executed. Second, it synchronizes the scheduler with the system clock to ensure that the commands will be executed at the proper time, especially after the system clock has been adjusted.
Both required and optional parameters are described in Table A.73.
Option |
Description |
---|---|
\\computername |
Enters the name of the remote system on which to schedule the command. The default (without the parameter) is the local system. |
id |
Enters the identification number of the scheduled command that is displayed when the at command is run without parameters. To display information specific to this particular job number, enter the command at id. |
/delete |
Deletes the scheduled command represented by id or deletes all scheduled commands on the computer. Use the /yes parameter in conjunction with /delete to automatically respond "yes" to any prompts that /delete provides. |
time |
Enters the time a command is to run using the format of hours:minutes, where acceptable values are 00:00 through 23:59. The hours must be in 24-hour format. |
/interactive |
Permits the scheduled command to interact with a logged-on user's desktop while the command is running. Use this option only when you know that a user will be logged on. It is not a good idea to use it when scheduling off-hours backups. |
/every:date |
Executes the scheduled command on every specified day of the week (M, T, W, Th, F, S, Su) or specified days of the month (1 through 31). Separate multiple date entries with commas. The default is the current date. |
/next:date |
Executes the scheduled command on the next specified day of the week (M, T, W, Th, F, S, Su) or next specified days of the month (1 through 31). Separate multiple date entries with commas. The default is the current date. |
"command" |
Enters the command to be run at the scheduled day and time, where command is a Windows Server 2003 command, a program (files with extensions .exe or .com), or a batch program (files with extensions .bat or .cmd). All types of commands except those with an .exe extension should be preceded by cmd /c. Use only absolute path names when path names are required. When specifying remote computers, use the \\computername\sharename designation rather than the assigned remote drive letter. Enclose the command in quotes. |
Since the at command runs in the background, it is a good idea to redirect its results to a file using the redirection symbol (>).
To display the network statistics for the server every Monday, Wednesday, and Friday at 10:00 a.m., enter the following:
at 10:00 /every:M,W,F "net statistics server > srvrstat"
The srvrstat file will be placed in the system's root directory.
To delete a scheduled job, first determine the ID number by running the at command without options. If, say, the ID number is 3, enter the following
at 3 /delete
The Task Manager enables a user to display and control the processes and applications running on the local system. It also allows the user to monitor the system performance.
To access the Task Manager, right-click in an open area of the taskbar and select this application. The taskbar displays at the bottom of the screen by default and displays the Start menu button as well as a list of the open windows on the desktop.
There are three tabs within the Task Manager: Applications, Processes, and Performance. Each of these will be discussed briefly.
The Applications tab displays the name and status of any applications currently running on the local computer. It offers three functions: ending a task, switching to a task, and starting a new task.
Ending a task is the same as terminating an application. To do it,
Select the application you wish to terminate.
Click End Task.
As an alternative to selecting a task from the taskbar, the Task Manager can switch to another task in this way:
Select the application you wish to switch to.
Click Switch To.
As an alternative to starting a task from the desktop or from the Start menu, the Task Manager can start a new program as follows:
Press the New Task button.
Enter the name of the new task or select Browse and browse through the available programs to select one.
The Processes tab offers information about the processes currently running on the local system. The default information for each process includes name, ID number, CPU and CPU time, and memory usage. To display additional or different information, select View Select Columns from the menu bar.
To end, or kill, a process, first select it and then click End Process at the bottom of the window. Or right-click the process and select End Process from the menu that displays. Also, see the Process View and Kill.exe options described in the Resource Kit Support Tool section.
To change the priority for a process, right-click the process. From the menu that displays, select Set Priority, and then choose Realtime, High, Normal, or Low.
The Performance tab allows the user to monitor the performance of the local computer. Information, displayed numerically or graphically, includes CPU usage and history; memory usage and history; total number of threads, handles, and processes; and physical and kernel memory.
Windows Server 2003 also provides a configurable Performance Monitor that can be accessed by selecting Start All Programs Administrative Tools Performance.
This section briefly discusses other system management tools that are of interest to administrators and users.
To log off the system, press CTRL+ALT+DEL to display the Windows Server 2003 Security window. Then select the Logoff button. You can log in again as the same or as a different user.
There are two ways to shut down the system: Select Start Shutdown or select Shutdown from the Windows Server 2003 Security window, which is accessed via CTRL+ALT+DEL.
There are times when a user or an administrator must define or change system environment variables, such as default paths and temporary directories. To do this, select Start Settings Control Panel System, and in the System Properties window, select the Environment tab. Only administrators may change System Variables, but users or administrators may change User Variables.
To change a variable, select it and it will display in the Variable and Value fields at the bottom of the screen. Make whatever changes are necessary, and then click Set.
To add a variable, just enter its name and value in the appropriate fields and then click Set.
To delete an environment variable, select it and then click Delete. In all cases, click OK to exit the window. Changes made to system variables are effective the next time the computer is restarted. Changes made to user variables are effective the next time the user logs on to the computer.
Top |