Common system configuration techniques

Users often want to alter their Windows NT system configuration to make tasks easier. You can make simple alterations with a Registry editor. Using a Registry editor incorrectly can cause serious systemwide problems that can require you to reinstall NT to correct them. Always back up your system before editing the Registry.

Another useful system configuration utility is shutdown.exe. The Microsoft Windows NT Server 4.0 Resource Kit includes this utility. The resource kit is an integral part of NT, and its text and utilities can simplify various NT tasks. I urge you to install the resource kit and take advantage of its tools.

Q: How do I change the organization name and username on Windows NT?

When you install NT you must enter a company name and username. After you set this information, you can't use ordinary NT configuration procedures to change it, but you can manipulate the Registry.

To change your organization name, start a Registry editor (regedit.exe) and go to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion. Double-click RegisteredOrganization, change the data, and click OK, as Screen 1, page 192, shows. To change your username, follow the same procedure and choose RegisteredOwner.

Q: How do I change the default Windows NT desktop background?

Before you log on, NT uses the background configuration in the default user profile, as Screen 2, page 192, shows. You can use a Registry editor to change default settings such as background bitmap and colors.

To change the background bitmap, start regedit.exe and go to HKEY_USERS\.DEFAULT\Control Panel\Desktop. Double-click Wallpaper, enter the bitmap and location you want to use, and click OK. To change the background color, go to HKEY_USERS\DEFAULT\Control Panel\Colors\Background and change the color value (e.g., change to 0 0 0 for black). NT uses standard RGB colors, which you can find in any graphics program. Screen 3, page 193, shows a customized background.

Q: How do I change the default Windows NT screen saver?

To change the default screen saver, start a Registry editor (regedit.exe) and go to HKEY_USERS\.DEFAULT\Control Panel\Desktop. Double-click ScreenSaveActive and set the value to 1. Then, double-click scrnsave.exe and set the screen saver name (e.g., black16.scr). Double-click ScreenSaveTimeOut and set the number of seconds (e.g., 600 seconds for 10 minutes).

If you want to use an OpenGL screen saver, you need to add some Registry values. To configure the OpenGL text screen saver, start regedit.exe and select HKEY_USERS\.DEFAULT\Control Panel\Desktop. Double-click scrnsave.exe and change the value to E:\WINNT\System32\sstext3d.scr. From the Registry editor menu bar, choose Edit, New, Key. Create a key called HKEY_USERS\.DEFAULT\Control Panel\Screen Saver.3DText. Under this new key, create two new string values called Font and Text. Choose Edit, New, String Value. Double-click Font and set the font you want (e.g., Arial). Double-click Text and set the text you want the screen saver to display (up to 16 characters).

To configure other OpenGL screen savers, configure the text screen saver for a typical user. Then examine the user's Registry entry for existing Registry values (e.g., Screen Saver.3Dpipes).

OpenGL screen savers use excessive system resources. Users often complain about slow server performance, because OpenGL screen savers monopolize the CPU when the machine is in screen saver mode. Use these screen savers with discretion, and always use a blank screen saver on servers.

Q: How can I restore Program Manager?

By default, Windows NT 4.0 uses Explorer (explorer.exe), but it still offers Program Manager (progman.exe). If you prefer Program Manager to Explorer, you can use a Registry editor to change the default.

Start regedit.exe and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon. Double-click Shell, change the value from explorer.exe to progman.exe, and click OK. You must then log off and log on again to use Program Manager. Screen 4 shows the Program Manager dialog box.

Q: How do I add an item to the right-click menu?

To add items to the context menu, start a Registry editor (regedit.exe) and go to HKEY_CLASSES_ROOT\Unknown\shell. From the Registry editor menu bar, select Edit, New, Key.

Enter the name you want the context menu to display (e.g., an application name). Right-click the new subkey and select New, Key. Enter the name

Command

Click the new command and double-click the entry labeled (Default) in the pane on the right. Enter the path and name of the executable, followed by %1 (e.g., D:\Program files\savedit\savedit.exe %1). Click OK. When you right-click a file, the menu will display the new entry.

Q: How can I remove invalid entries from the Add/Remove software list?

Users often install software that they later dislike. They then delete the directory structure and remove the icon from the Start menu but leave DLLs the software placed in the %systemroot% area. Most programs create remove entries that you can access through the Add/Remove Control Panel applet. But if you delete the program structure, the remove entry won't work.

Each entry on the Add/Remove program list is also a Registry entry. To remove an entry, start a Registry editor (regedit.exe) and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Win-dows\CurrentVersion\Uninstall. Select the item that corresponds to the entry. From the Registry editor menu bar, select Edit, Delete.

When you uninstall software, you can use the Registry editor to view the command run. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Win-dows\CurrentVersion\Uninstall to examine the UninstallString that is part of the specific software key.

Sometimes the software is installed but the entry doesn't work. For example, in TweakUI, the uninstall program tries to run %systemroot%/rundll32.exe, but rundll32.exe resides in %systemroot%/system32. In this case, you need to substitute the correct image location (E:\WINNT\System32\rundll32.exe) in UninstallString to run the command manually. Because rundll32.exe resides in E:\WINNT\System32, to remove it you need to go to the command line and type

E:\WINNT\system32\rundll32.exe syssetup.dll,SetupInfObject
InstallAction DefaultUninstall 4 E:\WINNT\Inf\Tweakui.Inf

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

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 .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.

Syndicate
Publication Info