Microsoft Windows Registry Guide, Second Edition
Creating Distribution Folders
To add files to the Windows distribution folder, you start by making a copy of the CD's i386 folder onto your hard disk because you can't modify the CD. You don't need the rest of the files or folders on the CD–just the i386 folder. In a corporate deployment, you'll eventually replicate the customized i386 folder on distribution servers and then deploy the command that installs Windows from them. If you're a power user, you'll likely burn a custom CD that contains your files. You add files to the distribution folder by creating the structure shown in Figure 14-1.
Figure 14-1 In addition to creating this folder structure, you must set OEMPreinstall=Yes in your Windows answer file.
Here's a description of the most important files and folders in Figure 14-1:
- i386 folder.
This is the i386 folder from the Windows CD, including all of its subfolders and files.
- $OEM$.
This is the OEM distribution folder that contains the additional vendor files that you want to deploy and that are required to install Windows. If you use the OemFilesPath setting in the [Unattended] section of the answer file, you can create the $OEM$ folder outside the i386 folder. I often create multiple $OEM$ folders (one for each different configuration) and deploy each along with a single i386 folder. To do that, for each configuration, I create an answer file that points to a unique $OEM$ folder. You must include OemPreinstall=Yes in the [Unattended] section of the answer file if you are using the $OEM$ folder to add files to the system or if you are using Cmdlines.txt to run other programs during installation.
- Cmdlines.txt.
This file contains optional commands that the setup program runs during installation. The file format is similar to an INI file. You create this file in the $OEM$ folder, adding each command to the [Commands] section. For more information about using Cmdlines.txt, particularly for deploying user settings with Windows, see the section “Cmdlines.txt” later in this chapter.
- $$Rename.txt.
This is an optional file that Setup uses during installations and is started from MS-DOS to convert short file names to long file names. You can create a $$Rename.txt file for each folder that contains short file names that you want to rename, or you can use one $$Rename.txt file for an entire folder tree. I often use this file when deploying third-party device drivers that use long file names.
- $OEM$\Textmode.
This folder contains hardware-dependent files that Setup Loader and the text-mode setup program install on the target computer during text-mode setup. These files include OEM hardware abstraction layers (HALs), mass storage controller device drivers, and the Txtsetup.oem file, which describes how to load and install these components. List these files in the [OEMBootFiles] section of your answer file. This folder isn't as necessary as it was when hardware configurations varied more widely.
- $OEM$\$$.
This is the folder into which you add files and subfolders that you want the setup program to copy to the target computer's %SystemRoot% folder. This is how to customize Windows system folders. To add a file called Sample.dll to %SystemRoot%\System32, add it to $OEM$\$$\System32. The setup program creates subfolders that don't exist on the target computer. Therefore, to deploy third-party device drivers with Windows, you can create a new subfolder called Drivers in %SystemRoot%. OemPnPDriversPath must indicate the location of the third-party device drivers on the target computer–in this case, OemPnPDriversPath=%SYSTEMROOT%\Drivers.
- $OEM$\$1.
This folder enables you to add files and folders to %SystemDrive% on the target computer. It works in a similar way to $OEM$\$$, except that you use $OEM$\$1 to add files to the root of the drive on which you're installing Windows. A typical example is creating a folder on %SystemDrive% called $OEM$\$1\Sysprep, which automatically adds the Sysprep folder and files necessary to prepare the target computer's drive for duplication. (See Chapter 15, “Cloning Disks with Sysprep,” for more information about disk imaging.)
TIP
You can use Setup Manager to create the i386 distribution folder for Sysprep, Remote Installation Services, or an unattended installation using an answer file. Setup Manager is in Deploy.cab, which is located in \Support\Tools on the Windows CD. Open Deploy.cab in Windows Explorer, and extract its contents to a folder on your hard disk. I prefer to create the distribution folder manually because many options aren't available through Setup Manager's user interface. For more information, see the section “Setup Manager” later in this chapter.
Customizing Default Settings
Windows doesn't invent its settings automatically. It uses four INF files in the i386 distribution folder to create the registry's hive files when you install the operating system. These INF files use the same syntax as the one I described in Chapter 11, “Scripting Registry Changes,” and you should be able to customize them easily. Here are those four INF files:
- Hivecls.inf.
This INF file creates the settings in HKLM\SOFTWARE\Classes (HKCR).
- Hivedef.inf.
This INF file creates the settings in HKU\.DEFAULT. It also creates the settings for the default user profile.
- Hivesft.inf.
This INF file creates the settings in HKLM\SOFTWARE.
- Hivesys.inf.
This INF file creates the settings in HKLM\SYSTEM.
You can change any of the Windows default settings by changing the setting in the hive files listed. For example, if you want to deploy some of the per-user hacks shown in Chapter 4, “Hacking the Registry,” change those values in the file Hivedef.inf in lieu of creating a default user profile for Windows. If you want to change file associations for every computer in the organization, change them in the file Hivecls.inf. Of course, this method isn't officially supported, so carefully test your changes before deploying in an enterprise environment.