Q: How can I configure a machine to reboot at a certain time?
On a busy server, a machine gradually runs out of resources. You can regularly reboot the machine to improve performance, but periodically rebooting a machine during working hours is often difficult. Another option is to schedule automatic rebooting during non-business hours.
The Microsoft Windows NT Server 4.0 Resource Kit includes a command-line utility called shutdown.exe that lets you shut down or reboot a local or network machine. For a complete list of flags you can set, go to the command line and type the following:
shutdown /?
When you install the resource kit, the installation procedure automatically adds the resource kit directory to the system path. To verify correct installation, go to Control Panel, System, Environment. If you have problems with the shutdown.exe command, use the fully qualified path name (i.e., D:\reskit\shutdown.exe).
The command to reboot the local machine is shutdown /l /r /y /c. The /l tells the utility to shut down the local machine, /r to reboot, /y to answer yes to any questions, and /c to close all programs. You can use this command with the AT command to schedule a reboot. (To use the AT command, you must run the Schedule service. From the Start menu, select Settings, Control Panel. Double-click Services, select Schedule, and click Start.) To schedule a reboot, type
at <time> shutdown /l /r /y /c
You can also specify days of the week. For example, to reboot every weekday at 8:00 p.m., type
at 20:00 /every:M,T,W,Th,F shutdown /l /r /y /c
You'll have 20 seconds before the machine shuts down. To abort the shutdown, type
shutdown /l /a /y
You need to take the same precautions in an automated reboot as you do in a manual reboot. For example, if your server is running SQL Server, you'll want to call a batch file to shut down currently active services or software before you call the shutdown.exe utility.
Q: How can I change the alert for low disk space on a partition?
By default, when a partition has less than 10 percent free disk space, the system creates an ID 2013 event with the following text: The disk is at or near capacity. You may need to delete some files. You can use a Registry editor to change the percentage of disk space for which the system creates an alert.
Start regedit.exe and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters. If the DiskSpaceThreshold value exists, double-click it. Otherwise, from the Registry editor menu bar, select Edit, New, DWORD Value. Enter the name DiskSpaceThreshold and click OK. Then, double-click the new value. Set the Base to Decimal, and enter a value (i.e., 0-99) for the percentage of free disk space below which you want the system to generate an alert. Click OK, and restart the machine.
You can also configure extra alerts. For information about configuring alerts, see "Troubleshooting NT Performance Monitoring," April 1998.
Q: How do I remove an applet from Control Panel?
Each item in Control Panel corresponds to a .cpl file. Some .cpl files represent multiple Control Panel applets. Table 1 lists common .cpl files and their corresponding applets.
When Control Panel starts, it searches %systemroot%/system32 for all .cpl files. To remove an item from Control Panel, you can rename the .cpl file and thus prevent Control Panel from finding it. For example, to remove the Date/Time applet, rename timedate.cpl to timedate.non.
You can also use a Registry editor to remove applets. Start regedit.exe and go to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoSetFolders. (You might have to create this value, because it doesn't exist by default.) Set the (REG_DWORD) value to 1 for each user to hide the Control Panel, Printers, and My Computer applets in Explorer and on the Start menu.
You can prevent a user from running an applet without deleting it. Place the boot partition on NTFS and remove the user's read permission.
Q: How can I run a Control Panel applet from the command line?
The Control Panel utility, control.exe, accepts an applet name as a parameter. To run an applet from the command line, type
control <applet name>.cpl
Table 1 lists Control Panel applets by .cpl file. Some .cpl files represent multiple Control Panel applets. For these files, you need to tell the utility which applet to run. For example, to run the Printers applet, type
control main.cpl printers
An alternative is to associate the .cpl extension with control.exe, using the ASSOC and FTYPE commands. Then you can type only the applet name. To associate a .cpl extension with control.exe, go to the command line and type
assoc .cpl=ControlFile
ftype ControlFile=control.exe %1 %*
You can then enter only the applet name (with .cpl extension) to run it.