Improve the Way Single-User Applications Work with Terminal Server
One tricky part of setting up server-based (i.e., thin-client) computing is making applications designed for one user work for multiple users. If you're using Windows NT Server 4.0, Terminal Server Edition, you might have trouble with some applications. As I wrote in "Can a Hybrid Network Work for Your Enterprise?" October 1998, not all applications work well in a thin-client environment. Some use up too many CPU cycles or too much memory, some can't tell whether to apply settings to a user or a computer, and some store information in locations inappropriate to a multiuser OS. Sometimes you're stuck with these problems; if you use such applications, you need to run them from the client desktop. However, some problems are fixable if you take a little time.
Not every application works with Terminal Server, but the following tips will help you tweak those that do. (For information about tweaking DOS applications, see the sidebar "Performance Tuning for DOS Applications," page 72.)
How Applications Install into Terminal Server
To work properly in a multiuser environment, applications need to edit the HKEY_CURRENT_USER branch of the Registry rather than the HKEY_LOCAL_MACHINE branch. Otherwise, per-user settings apply to everyone using the application. Sometimes this condition is merely annoying, and sometimes it's a security violation because users can see or overwrite one another's personal settings. Well-behaved Terminal Server applications make their settings apply to users, not to machines.
However, you can't install applications into HKEY_CURRENT_USER. This key applies to only the current user, and the identity of the current user changes. Thus, you can install applications on Terminal Server in one of two ways: globally, for everyone who logs on to the server, or singly, for the exclusive use of the person logged on during the application's installation. Unfortunately, you can't install an application for a user while you're logged on with another account. Nor can you specify a subset of users who have access to a particular application. If you want only a couple of people to have access to an application, you need to install it for each user separately. After you've installed the application, you can use NTFS permissions to lock it down, and you can create custom profiles that don't provide shortcuts or Start Menu options for the application.
Installing Applications for Multiple Users
How does Terminal Server know how to install an application? Each Terminal Server session has two operating modes: Execute and Install. The names are descriptive of each mode's purposeExecute mode is for running applications, and Install mode is for installing applications. The mechanics of installing an application depend on which mode you're in when you're running the application's Setup program.
When a session is in Install mode, it creates Registry entries and Terminal Server copies all those Registry entries under the HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\WindowsNTCurrentVersion\TerminalServer\ Install Registry key. Whenever an application adds keys, Terminal Server copies those keys to HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ Windows NT\CurrentVersion\Terminal Server\Install\Machine Registry key.
You don't have to know all this in regard to Win32 applications. What you do have to know is that when the session is in Execute mode (the usual mode unless you specify otherwise), if an application attempts to read an HKEY_
CURRENT_USER Registry entry that doesn't exist, Terminal Server looks under HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\WindowsNT\CurrentVersion\ Terminal Server\Install for the missing key. If it finds the key, Terminal Server copies the key and its subkeys to the appropriate location under HKEY_
CURRENT_USER and copies any .ini files or user-specific .dll files to the user's home directory. If the user doesn't have a home directory, the files go to the user's personal folder in \%systemroot%\profiles.
You can put Terminal Server into Install mode with either the Change User command-line utility (if you're installing applications with Run or with the installation program that comes with the application) or a switch in the Add/Remove Programs applet in Control Panel. Change User lets you choose from three options:
- /execute (the default option), in which applications install in single-user mode
- /install, which puts Terminal Server into Install mode
- /query, which reports the mode that the session is in
Before running a setup program, open a command prompt and run Change User/install. The system will copy all entries to the appropriate Registry key for later copying to each user's Registry settings when the users run the application within their sessions.
If you put a Terminal Server session into Install mode with Change User, the session will stay that way until you run Change User again to revert the session to Execute mode. Therefore, if you want to be sure that Terminal Server goes into Execute mode when you're finished installing an application, the best way is to use the Add/Remove Programs applet.
Add/Remove Programs will put the session into Install mode for the duration of the setup procedure, then automatically revert to Execute mode when setup completes. After prompting you for the location of the installation files, the installation wizard will ask whether you want to give all users the same initial settings (the default option) or whether you want the application settings to apply to only the user from whose workstation you're installing the application. If you choose the default option, you'll put Terminal Server into Install mode. When the application's Setup program finishes running, you'll go back to the wizard, which will prompt you to click Next. Finally, you'll see a dire-looking dialog box telling you to click Finish or Cancel when the installation process is complete but warning you in capital letters not to click before the process is finished. Clicking Finish or Cancel returns the session to Execute mode.
CURRENT_USER branch of the Registry. If an update to an application requires subsequent updates to user settings, how do you enact these changes? I've tried installing the update via the Control Panel Add/Remove Programs applet, and through the command-line change user /install mode. Although the HKEY_LOCAL_MACHINE and the HKEY_
CURRENT_USER settings get updated, not all the other user settings do. Is there a way to see and edit each user's Registry without signing on as that user? Or is there a way to make sure each user gets updated?
Heidi DeRosa December 13, 1999