Script makes the right adjustments

REG.EXE is an NT 4 Resource Kit utility. Use it, along with SMS Installer, to adjust software settings while multiple users are logged on to a system.

Please let us know how useful you find this tip by rating it below. Do you have a useful Windows tip, timesaver or workaround to share? Submit it to our tip contest and you could win a prize!


We have all worked with software that requires certain settings to be adjusted while the software's user is logged in to the system. This can be very frustrating when more than one person uses a system.

If you want to avoid revisiting a workstation multiple times, then make sure that whomever logs on to the system has a registry setting in his profile. Using the NT 4 Resource Kit utility REG.EXE, along with Systems Management Server (SMS) Installer, you can accomplish this.

Understanding how user profiles interact with the registry is key to making effective use of this script. One common misconception is that making changes to the [KHEY_USERS\.DEFAULT] key will make the changes to the Default User profile. This is not the case. The [.DEFAULT] key actually governs the state of the computer when no user is logged in. If you want a certain background bitmap to appear behind the Ctrl + Alt + Delete screen, set the Wallpaper value in [HKEY_USERS\.DEFAULT\Control Panel\Desktop]. The keys that are left under [HKEY_USERS] represent the registry hives of the local administrator account, the currently logged in user and any service accounts currently being used to run services.

The registry settings for the Default User profile are actually stored in the NTUSER.DAT file in the Default User profile folder. To create a custom Default User profile, log in to a system and customize your profile settings. Then use the System Properties applet to copy the profile to the Default User directory. This effectively copies the NTUSER.DAT file from your profile to the Default User directory.

When a user logs on to a system, that person's registry hive is loaded from the NTUSER.DAT file located in the user's profile directory to a key represented by the user's SID under [HKEY_USERS]. If the person has never logged on to the system before, a copy of NTUSER.DAT from the Default User profile is loaded for that user. When the user logs off of the system, the [HKEY_USERS\SID] registry key disappears, and all of the user-specific registry settings are stored in the NTUSER.DAT file in that user's profile directory.

In order to modify a user-specific registry setting for an existing profile or the Default User, you can use REG.EXE from the NT 4 Resource Kit. REG.EXE lets you load a stored registry hive, make changes to it, then save it back to a flat file. While the documented syntax does allow you to update or add values, I found it very problematic. Instead I use REG.EXE's Open, Save and Close syntax along with SMS Installer's Edit Registry functions to make the changes.

The SMS Installer script below creates a text file with a list of the paths to each existing profile by searching for and renaming each ntuser.ini file on the system. This file exists in every profile folder except Default User. The Default User profile location is pulled from the registry and placed into the text file also.

C:\Documents and Settings\amybanford
C:\Documents and Settings\Administrator
C:\Documents and Settings\SMSCliSvcAcct&
C:\Documents and Settings\SMSCliToknAcct&
C:\Documents and Settings\Default User

The script then reads each line of the text file and loads and changes each profile's registry hive. This script should be executed by SMS when no user is logged on to a system. An NTUSER.DAT file that is in use cannot be loaded. Therefore, the script does not try to load the hive if the profile path contains "SMS" because the SMSCliSvcAcct& account is used to execute advertised programs with SMS.

Click here for the script: 2152AllUserReg.ipf.

 


Amy Banford is the SMS Administrator for Total System Services Inc. (TSYS) in Columbus, Ga. At TSYS she maintains a large SMS 2.0 site hierarchy. She also handles all software distribution, package creation and custom SMS Web reports. She can be reached at abanford@tsys.com.

This article first appeared in myITforum.com, the online destination for IT professionals who manage their corporations' Microsoft Windows systems and is also part of the TechTarget network of industry specific IT web sites. The centerpiece of myITforum.com is a collection of member forums where IT professionals exchange technical tips, share their expertise and download utilities that help them better manage their Windows environments, specifically Microsoft Systems Management Server (SMS).

This was first published in May 2005
This Content Component encountered an error

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close