Customizing Answer Files
As you have already learned, an answer file is a script that looks much like an INI file. The script drives the setup program, rather than the setup program prompting the user for information. Not only does an answer file automate the setup program's user interface, but it also enables you to configure Windows in ways that aren't possible through the user interface. I use an answer file to change the location of user profiles from %SystemDrive%\Documents and Settings to %SystemDrive%\Profiles, for example, because I much prefer the shorter path to typing C:\Documents and Settings over and over again.
Unattend.txt is the traditional name for answer files, but I prefer to give answer files names that make it easy to decipher their purpose. Just make sure to limit their names to eight characters so that you can read their names when installing Windows using MS-DOS. (MS-DOS is an antiquated method of installing Windows. Using Microsoft Windows PE is a better way, as described in Chapter 16, “Configuring Windows PE.”) Also, I don't like to use the .txt extension for answer files. I prefer to use .sif, which is the file extension for Setup Information Files, so that I can easily differentiate a text file from an answer file. For example, I might have an answer file to install Windows on a lab computer called Labprep.sif. You might create different answer files for different departments called Sales.sif, Legal.sif, and so on. Regardless, use descriptive names that help you discern the differences between answer files, because you'll grow a collection.
Listing 14-1 shows a sample answer file. (Most tend to be neither this complicated nor this well-documented with comments.)
Listing 14-1 Unattend.txt
[Unattended] UnattendMode = FullUnattended TargetPath = Windows FileSystem = LeaveAlone OemPreinstall = Yes OemSkipEula = Yes [GuiUnattended] ; Set the TimeZone. For example, to set the TimeZone for the ; Pacific Northwest, use a value of "004." Be sure to use the ; numeric value that represents your own time zone. To look up ; a numeric value, see the Deploy.chm file on the Windows CD. ; The Deploy.cab file is in the \Support\Tools folder. TimeZone = "YourTimeZone" OemSkipWelcome = 1 ; The OemSkipRegional key allows Unattended Installation to skip ; RegionalSettings when the final location of the computer is unknown. OemSkipRegional = 1 [UserData] ; Tip: Avoid using spaces in the ComputerName value. ComputerName = "YourComputerName" ; To ensure a fully unattended installation, you must provide a value ; for the ProductKey key. ProductKey = "Your product key" [LicenseFilePrintData] ; This section is used for server installs. AutoMode = "PerServer" AutoUsers = "50" [Display] BitsPerPel = 16 XResolution = 800 YResolution = 600 VRefresh = 60 [Components] ; This section contains keys for installing the components of ; Windows. A value of On installs the component, and a ; value of Off prevents the component from being installed. iis_common = On iis_inetmgr = Off iis_www = Off iis_ftp = Off iis_doc = Off iis_smtp = On ; The Fp_extensions key installs Front Page Server Extensions. Fp_extensions = On ; If you set the TSEnabled key to On, Terminal Services is installed on ; a current version of Windows Server. TSEnabled = On ; If you set the TSClients key to On, the files required to create ; Terminal Services client disks are installed. If you set this key ; to On, you must also set the TSEnabled key to On. TSClients = On Indexsrv_system = On Accessopt = On Calc = On Charmap = On Chat = Off Clipbook = On Deskpaper = On Dialer = On Freecell = Off Hypertrm = On Media_clips = On Media_utopia = On Minesweeper = Off Mousepoint = Off Mplay = On Mswordpad = On Paint = On Pinball = Off Rec = On Solitaire = Off Templates = On Vol = On [TapiLocation] CountryCode = "1" Dialing = Pulse ; Indicates the area code for your telephone. This value must ; be a 3-digit number. AreaCode = "Your telephone area code" LongDistanceAccess = 9 [Networking] [Identification] JoinDomain = YourCorpNet DomainAdmin = YourCorpAdmin DomainAdminPassword = YourAdminPassword [NetOptionalComponents] ; Section contains a list of optional network components to install. Snmp = Off Lpdsvc = Off Simptcp = Off [Branding] ; This section brands Microsoft(r) Internet Explorer with custom ; properties from the Unattended answer file. BrandIEUsingUnattended = Yes [URL] ; This section contains custom URL settings for Microsoft ; Internet Explorer. If these settings are not present, the ; default settings are used. Specifies the URL for the ; browser's default home page. For example, you might use the ; following: Home_Page = www.microsoft.com. Home_Page = YourHomePageURL ; Specifies the URL for the default search page. For example, you might ; use the following: Search Page = www.msn.com Search_Page = YourSearchPageURL ; Specifies a shortcut name in the link folder of Favorites. ; For example, you might use the following: Quick_Link_1_Name = ; "Microsoft Product Support Services" Quick_Link_1_Name = "Your Quick Link Name" ; Specifies a shortcut URL in the link folder of Favorites. For example, ; you might use this: Quick_Link_1 = http://support.microsoft.com/. Quick_Link_1 = YourQuickLinkURL [Proxy] ; This section contains custom proxy settings for Microsoft ; Internet Explorer. If these settings are not present, the default ; settings are used. If proxysrv:80 is not accurate for your ; configuration, be sure to replace the proxy server and port number ; with your own values. HTTP_Proxy_Server = proxysrv:80 Use_Same_Proxy = 1
You tell the setup program about your answer file using the /unattend command-line option. You can shorten this to /u. (We all know that technology professionals and enthusiasts have a limited number of keystrokes in their lifetime.) You also must use the setup program's /source command-line option, which you can shorten to /s, to tell it where to find the Windows source files. The setup program's command line has many other options that control how it works. For more information about them, see Deploy.chm in Deploy.cab in the Support\Tools folder of the Windows CD. The following sample commands run the MS-DOS–based setup program from \\camelot\wxppro:
net use w: \\camelot\wxppro w:\i386\winnt /s:w:\i386 /u:w:\winnt.sif
The following sample commands run the setup program from \\camelot\wxppro from Windows PE or another 32-bit version of Windows:
net use w: \\camelot\wxppro w:\i386\winnt32 /source:w:\i386 /unattend:w:\winnt.sif
Setup Manager
You can use Setup Manager to create answer files for unattended Windows installations, automated installations using Sysprep, or automated installations using Remote Installation Services. Setup Manager is on the Windows CD in the Deploy.cab file of the Support\Tools folder. Setup Manager is a wizard that helps you create and modify answer files by prompting you for the information required to create answer files. Setup Manager can create new answer files, import existing answer files, and create new answer files based on a computer's current configuration. The last option is useful when you want to configure network settings in an answer file and you don't understand all the settings available or you don't want to risk errors, which are likely, considering how complex these sections sometimes are.
To install and run Setup Manager, double-click Deploy.cab in the Windows CD's Support\Tools folder, copy the cabinet file's contents to a folder on your disk, and double-click Setupmgr.exe to run Setup Manager, as shown in Figure 14-2. The result of the wizard is an answer file. Table 14-1 describes some of Setup Manager's different pages in the order that you see them.
Figure 14-2 The Windows Setup Manager has greatly improved since the version in Windows 2000. Most of the changes are in the user interface, but encrypting the local administrator password is also a new feature.
Page | Description |
User Interaction | Use this page to set the level of user interaction during the setup process. Select Provide Defaults to display the configurable values supplied in the answer file, or select Fully Automated to create a setup process that requires no user interaction. |
Customize The Software | Use this page to specify an organization and a user name. |
Display Settings | Use this page to configure the display color depth, screen resolution, and refresh frequency display settings. I prefer to allow Windows to automatically adjust these settings to the best available, and you should generally avoid setting a refresh frequency if you're not 100 percent sure that all the monitors in use by your organization can support that frequency. Generally, 70 hertz (Hz) is a safe bet, and LCD monitors perform best with 60 Hz. |
Time Zone | Use this page to set the time zone. |
Product Key | Use this page to specify a product key, which is required for a fully automated installation. |
Computer Names | Use this page to tell Setup Manager to generate a Uniqueness Database File (UDF), which the setup program will use to give each computer a unique name. If you import names from a text file, Setup Manager converts them into UDF files. You can also set an option to generate unique computer names. |
Administrator Password | Use this page to tell Setup Manager to encrypt the local administrator password in the answer file so that users can't gain unauthorized access to the local administrator account. You can also configure the answer file to prompt users for the local administrator password during installation. If the Administrator Password box is blank, you can use the AutoLogon feature to automatically log on to the client computer as an administrator. For more information about using the AutoLogon feature with [GuiRunOnce] to deploy user settings with Windows, see “[GuiRunOnce],” later in this chapter. |
Networking Components | Use this page to configure any network setting in Setup Manager that you can configure on the desktop. The interface for setting network settings in Setup Manager is the same as the one that you see in Windows. |
Workgroup Or Domain | Use this page to join computers to a domain or a workgroup. You can also automatically create accounts in the domain. |
Telephony | Use this page to set telephony properties, such as area codes and dialing rules. |
Regional Settings | Use this page to set regional options, such as date, time, and currency formats. |
Languages | Use this page to add support for other language groups. |
Browser And Shell Settings | Use this page to configure Internet connections, including proxy server settings. If you need to customize the browser, you can use Setup Manager to access the Microsoft Internet Explorer Administration Kit (IEAK), available from http://www.microsoft.com/windows/ieak/downloads/default.mspx. |
Installation Folder | Use this page to specify the default Windows folder, generate a unique folder during setup, or install Windows in a custom folder. For example, if you plan to keep Microsoft Windows 2000 in parts of your company or you are upgrading to Windows from Windows 2000, you can move Windows from the Windows folder to the Winnt folder so that you have a consistent folder structure throughout the organization. |
Install Printers | Use this page to install printers as part of the installation process. |
Run Once | Use this page to add commands that run automatically the first time a user logs on to the computer. Setup Manager adds these commands to the answer file's [GuiRunOnce] section. For example, you can start Microsoft Office 2003 Editions setup program from here. For more information about using this feature to deploy user settings, see “[GuiRunOnce],” later in this chapter. |
Additional Commands | Use this page to add commands that run at the end of the setup process and before users log on to the system, such as starting a setup program or adding user settings. For more information, see “Cmdlines.txt,” later in this chapter. |
Notepad and Other Text Editors
Even with all of Setup Manager's features, I prefer to create answer files manually. Now, before you think I'm silly and just making work for myself, let me add that I have a library of answer-file templates that I call on when required. After you've created your first answer file, and you've got it just right, you can reuse it over and over again because little changes from job to job. I've got another surprise for you at the end of this section.
You can use a text editor, Notepad for example, to create answer files. They look just like INI files; both have sections, and their sections contain settings. You don't have to use all the sections or values available in the answer file if you don't need them. In fact, a typical answer file for a computer that you're joining to a Microsoft-based network is only about 20 lines long. If you add errors to an answer file, the setup program reports the line number containing the syntax error.
The answer file in Listing 14-2 is one that I use frequently. Notice that I've commented out the AdminPassword and FullName values by preceding them with a semicolon (;), so the setup program prompts the user for both values. You must provide your own product key for this sample. Also notice that I don't use the [Display] section in this answer file, but Windows automatically optimizes the display settings when the user logs on to the computer. Last, I've commented out the DomainAdmin and DomainAdminPassword values in this answer file so that the setup program will prompt the user for the credentials necessary to join the domain. I do this to avoid putting my domain administrator's credentials in an answer file. This isn't a problem, though, because I delegate ownership of each computer object to users so that they can use their own accounts to join their own computers to the domain.
Listing 14-2 Unattend.txt
[Unattended] FileSystem=ConvertNTFS OemPreinstall=Yes OemSkipEula=Yes TargetPath=\Windows UnattendMode=ReadOnly [GuiUnattended] ; AdminPassword= OEMSkipRegional=1 OEMSkipWelcome=1 ProfilesDir=%SYSTEMDRIVE%\Profiles TimeZone=020 [UserData] ComputerName=* ; FullName= OrgName="Jerry Honeycutt" Product [TapiLocation] AreaCode=972 CountryCode=1 Dialing=Tone [Identification] ; DomainAdmin= ; DomainAdminPassword= JoinDomain=HONEYCUTT [Networking] InstallDefaultComponents=Yes ;end
This answer file is just one example. I built this answer file to do a clean installation of Windows from MS-DOS. I also have answer files that upgrade Windows XP or Windows Server 2003. I have answer files that build disk images for deployment. I have still other answer files for deploying Windows through Remote Installation Services, building lab computers, installing Windows on mobile computers, installing Windows on Novell networks, and so on.
Jerry's Answer File Editor
Here's the surprise that I mentioned. I don't use Notepad to edit answer files. I use Microsoft Office Word 2003. Here's why:
Word includes built-in version control, enabling me to manage the different versions of an answer file over time. I can refer back to an earlier version of an answer file to see what I've changed.
Word includes revision tracking, which enables me to see the changes that I've made to the current version of my answer file. This is a great feature for documenting answer files as well as for sending answer files out for review.
Word enables reviewers to comment on answer files without actually changing them. This is another great feature for sending answer files out for review.
Word enables me to build custom dictionaries. I build custom dictionaries that include answer file section names and value names, which ensures that I don't add errors to answer files with something as silly as a typo.
I'm willing to bet that these four features are enough to convince you to start using Word to edit answer files. Doing so will make you a much more productive IT professional. The process requires one bit of explanation, though. I edit and review answer files as document files (DOC files). Only when I'm ready to build a distribution share do I export the answer file from Word to a text file. Enjoy!