Unattended XPCD
   


Registry Tweaks
Submitted by Vadikan

» Introduction


The idea behind importing the registry tweaks during unattended installation is that you won't have to tweak the system manually or with a tweaker afterwards. You will already have all your favorite tweaks imported into the registry upon the first logon. Perhaps, the classic tweak is to speed up the appearance of the Start menu elements, because they are indeed slow to open by default. You probably know, that opening the Registry editor (regedit.exe), navigating to the HKEY_CURRENT_USER\Control Panel\Desktop key and modifying the value of the MenuShowDelay parameter from 400 to, say, 20 does the trick.

Unattended XPCD

However, there's an alternative way. You can accomplish the same thing, if you copy the code below to a text editor (Notepad)
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop] 
"MenuShowDelay"="20"
save the file as "tweak.reg" (with the quotation marks to avoid the TXT extension) and launch the file. The tweak will be imported after you click Yes on the confirmation prompt.

Unattended XPCD

If you want to avoid the confirmation prompt, you can execute the following command from the command line
REGEDIT /S <path>\tweak.reg
where <path> is the path to the file unless it is in the same directory you launched the command line from. The /S swtich suppresses the confirmation prompt. Pretty much the same method is used for importing multiple registry tweaks during unattended setup. The only difference is that one can import multiple tweaks with a single *.REG file.

Below you'll find some registry keys and values (tweaks) I always change. Feel free to copy the text to a text editor to see them better. Please, do not attempt to import my registry tweaks into your system. These files are for the reference only. The fact that I use them doesn't mean you need them. For instance, I have System Restore and Windows Update turned off completely. Actually, I use separate files for exporting HKEY_LOCAL_MACHINE (HKLM) and HKEY_CURRENT_USER (HKCU) tweaks. Keep reading to find out why.

The fragments of my files:

HKLM.reg


HKCU.reg


» About registry hives and importing methods


After reading multiple threads about registry tweaks importing at MSFN and OSZone boards, I've come to the conclusion that some members misinterpret the meaning of the registry hives. I think some clarification won't hurt. I will highlight some aspects pertaining to the unattended installation without going into too much detail. I do encourage you to read an MS KB article Description of the Microsoft Windows registry, as it contains a lot of valuable and detailed information. Let's talk about the registry hives now.

» HKEY_LOCAL_MACHINE (HKLM)


As the title suggests, these are the local machine keys. The changes you make in this hive affect all users. Therefore, disabling a service makes it unavailable for all users. It is a good idea to import HKLM tweaks upon the first logon when the shell loads. Careful readers might think: "Hmmm... So it is possible to import the tweaks before the first logon, isn't it?" Possible, but is not really recommended for HKLM tweaks, because sometimes certain tweaks do not "stick" when imported on the earlier stages of the unattended setup. I'll provide more details about the earlier stages in the next section.

A typical (but not the only) method for importing HKLM tweaks is a batch file launched from [GuiRunOnce]. Below is a fragment of a sample batch file
ECHO. 
ECHO Applying Registry Tweaks... 
REGEDIT /S %systemdrive%\install\hklm.reg

» HKEY_CURRENT_USER (HKCU)


As the title suggests, these are the current user keys. Generally, the changes you make to this hive apply to the currently logged on user only. Certainly, you can import the HCKU tweaks upon the first logon. This is probably what you need to do, if you work under a built-in Administrator account and don't have any other accounts (which is not a very good practice) . Meanwhile, it is a good idea to work under a different account with the administrator rights and leave the built-in Administrator untouched just in case. The question is how to apply the HKCU tweaks for all accounts simultaneously.

Fortunately, there's an excellent resolution for those who configure more than one account and wish to have all accounts similarly tweaked. You can import registry tweaks at a certain stage of the unattended setup when nobody has logged on yet. This task can be accomplished from cmdlines.txt at T-12. Actually, the HKCU tweaks imported at T-12 modify the Default User account settings, because the Default User's hive is loaded into HKEY_CURRENT_USER at that moment. When a user logs on to a machine for the first time, the user settings are taken from the Default User account. Hence, the HKCU tweaks imported at T-12 apply to all accounts ever created. That is why I have two separate REG files (HKCU and HKLM). I import HKCU tweaks from cmdlines.txt, and no matter how many user accounts I create, they all have the same initial user settings.

In order to import the HKCU tweaks at T-12 you need to place the HKCU.reg file into the root of the $OEM$ folder and make sure the cmdlines.txt contains the following text:
[Commands]
"REGEDIT /S hkcu.reg"

» HKEY_CLASSES_ROOT (HKCR)


I won't duplicate a pretty thorough description of this hive given in the MS KB article Description of the Microsoft Windows registry. Please, familiarize yourself with it. My interpretation is as follows. If you want the changes to affect all users (including the ones created later on), then either import the HKCR keys together with the HKCU keys from cmdlines.txt or import the keys into HKEY_LOCAL_MACHINE\Software\Classes upon the first logon. To be honest, I've never had a need to import anything into this hive.

» HKEY_USERS (HKU)


The meaning of this key is often interpreted incorrectly. The hive pertains to all users who logged on to the system at least once. Perhaps, this fact causes the confusion. Let's look at the hive's components more closely.

HKEY_USERS\.DEFAULT

I've noticed that some MSFN and OSZone members use this hive for importing HKCU settings trying to apply them for all users. Possibly, this works; however, you already know how to import HKCU tweaks realiably and correctly. Moreover, the HKEY_USERS\.DEFAULT keys may pertain to the settings enforced before users log on (e.g. the default keyboard layout for the logon window).

HKEY_USERS\S-[long-set-of-numbers]

You may have several keys like that. It depends on the number of users who logged on to the system at least once. If you try to monitor the registry changes with any registry monitoring software, you probably find out that one of those keys is getting changed. This is your profile. Most of the time this key is not interesting from the practical standpoint, because the long set of numbers is unique and will not be the same in another system you install. Technically, changes in this key are equivavelnt to the changes in HKCU.

Hopefully, this short excurse through the registry was helpful.

» Practical Advices


As you probably know, one can configure lots of the system settings with the registry tweaks. I've forgotten when was the last time I used a tweaker on my system, because I have pretty much everthing configured right after the installation. Perhaps, you would like to do the same and now have a reasonable question: "How do I determine what registry values get changed whenever I modify the system settings via the Graphic User Interface (GUI)?"

There are multiple web sites with the registry tweaks. Here's the short list ;-) There's a sticky registry tweaks thread in the Unattended forum at MSFN. The first post of this thread has a text file attached with numerous registry tweaks.

Another good method is to configure your system elements the way you like it and then export the corresponding registry keys. It's a much better idea than using other people's tweaks. For example, a good portion of the Start menu and Folder Options settings is located in the
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
key. Hence, you can export the key from your current system and then import it during the unattended setup. If you are not sure what a certain parameter does, type its name into a search engine and you'll find out quickly.

If you searched, but came up with nothing ... you probably didn't search enough ;-) Try using registry monitoring software like Regmon (real time monitoring) and Regshot (registry snapshot before and after the changes).
--
Discussion thread
Last updated 2005-12-25 20:09:09 by Vadikan  [Edit]
All trademarks mentioned on this page are the property of their respective owners
MSFN is not affiliated with Microsoft
Copyright © 2001 - 2013 msfn.org
Privacy Policy