Script the Installation with Answer Files

Wednesday Feb 21st 2001 by Jerry Honeycutt

Take the guesswork out of users' hands by automating the Windows 2000 setup process with a crib sheet -- otherwise known as an answer file.

Answer files are like high-school chemistry crib sheets. They're lists of answers for questions that you know the setup program is going to ask but the user is not prepared to answer. You use them to automate the setup process.

More specifically, answer files look just like classic INI files. They are text files. They contain one or more sections, and each section contains one or more properties in the form name=value (see Listing 1). Windows 2000's setup program has a well-documented list of properties that it looks for in an answer file. The file Unattend.doc, which comes with the resource kit, lists all the properties you can use. If the setup program doesn't find a property, it either uses the default or prompts for a suitable value.

On first glance, answer files seem like nothing more than a clever way to automate the setup program. Not entirely truethey're more important than that. Answer files are the heart and soul of any Windows 2000 deployment. They put the administrator in control across spans and time. Whether you're deploying the operating system via a network share, disk image, or Remote Installation Service doesn't matter; you will always require an answer file.

Because they are so important, you'll learn about many advanced answer-file techniques over the next several months. In this installation of "Windows 2000 Deployment," however, you'll learn how to create an answer file, why using a template is better than Setup Manager, and how to use answer files with the Windows 2000 setup program.

Setup Manager

Just say no to Setup Manager. Setup Manager is a resource-kit program that creates answer files. It's a wizard, and it collects only portions of the useful settings you need. Beyond that, it's more cumbersome to use than my favorite answer-file editor, Notepad. Notepad is the ultimate answer file editor: It's quick, it's on every Windows desktop, and it makes available the full range of settings found in Unattend.doc.

The best practice for creating and editing answer files is simple: Keep a template handy. Each time you need to create a new answer file, make a copy of that template and edit it. In fact, use the example answer file you see in Listing 1 as a good starting template. You won't have to use Setup Managerever.

The one exception is a complex network configuration (think multi-homed domain controller or Novell NetWare). Rather than hand-editing the answer file, which is an error-prone process with anything but the most basic network configurations, use this process:

  1. Configure a computer to connect to the network.

  2. Test the configuration thoroughly.

  3. Create an answer file based upon that computer's configuration

  4. Copy the network settings from Setup Manager's answer file.

The last word on creating answer files is, well, Word. Consider using Microsoft Word 2000 to edit answer files. Doing so gives you more documentation and better change management, because the product supports revision tracking and rudimentary version control. You must edit answer files as DOC files, though, and when ready to test and deploy them, export them to SIF files on the network share.

Word has another feature that's useful for editing answer files: spell check. Create a custom dictionary, and then add to it each section and property name documented in Unattend.doc. Doing so helps prevent errors in your answer file by tagging incorrectly spelled names.

File Extensions

In the days of old, answer files used the TXT file extension.

You can still use TXT, but better choices are available. The following list describes the common file extensions for answer files and when to use each:

  • TXTUnattend.txt is still a common file extension. Because it does not differentiate an answer file from a plain old text file, don't use it.

  • SIFSIF is the acronym for Setup Information File. This is the best file extension to use for most answer files. Note that this is the only file extension that Remote Installation Service supports.

  • INFSysprep, a tool you'll learn about in this article series, uses the Sysprep.inf extension. Also, every time the setup program installs Windows 2000, it copies the answer file it used to %SystemRoot%\System32\$Winnt$.inf.

You need to know what happens when you create an answer file using Notepad or virtually any other editor that uses the common dialog boxes. If, after choosing File|Save As, you type "Winnt.sif" and press Enter, you end up with a file called Winnt.sif.txt. The common dialog boxes append the file extension shown in the Save As Type list to the end of the filewhether you used file extension or not. The moral? Make sure you enclose your file names in quotes, like Winnt.sif or, at the very least, change the Save As Type to All Files.

Working Example

Listing 1 is a sample answer file. It's a templatea good starting point for any Windows 2000 deployment. During this article series, we'll extend this answer file with often-overlooked but extremely useful settings. For now, let's content ourselves with the basic sections:

  • [Unattended]The setup program uses settings in this section during the text-mode phase of the setup process. Text-mode is the part that happens before the first reboot. Typical settings include those shown in the Listing 1. FileSystem specifies whether to use FAT or NTFS. OemSkipEula=Yes causes the setup program to skip the license agreement. And UnattendMode controls the setup program's user-interface level. You'll learn about more advanced settings, like DriverSigningPolicy, OemPnPDriversPath, and OemPreinstall, in the future.

  • [GuiUnattended]The next section, [GuiUnattended], has settings that the setup program uses during the graphical phase of the setup process. The listing contains a typical example. The local administrator password is left blank. The remaining settings cause the setup program to skip the first few screens.

  • [UserData]This section is usually the thinnest section in an answer file because, by their nature, answer files are generic and not user specific. The example shown in Listing 1 is typical. You can optionally set UserName to something like Valued Company Employee to avoid any prompts.

  • [Identification]Use this section to join a computer to a workgroup or domain using the mutually exclusive properties JoinWorkgroup and JoinDomain. You can also specify the administrator credentials necessary for joining the computer to a domain. Better methods are available for this requirement, though, and you'll learn about those in this series.

  • [Networking]The [Networking] section specifies the computer's client, server, service, and protocol configurations. For computers connected to Microsoft networks that use DHCP, InstallDefaultComponents=Yes is all you need in this section. The networking configuration for other networks is less straightforward but well documented in the resource kit's Unattend.doc file.

    Listing 1: Sample Answer File

        OrgName="Jerry Honeycutt"

    Again, this is not an answer file that you will deploy. This is a template that you'll copy and edit in lieu of creating answer files with Setup Manager. This and a copy of Unattend.doc are all you need to knock out Windows 2000 answer files.

Using Answer Files

Writing the answer file is step one. Using it with Windows 2000's setup program is next. Use Winnt.exe from MS-DOS and Winnt32.exe from Windows. The command line is straightforward:

Winnt[32] /s:source /u:answers

In this line, /s:source is the path of the Windows 2000 i386 folder and /u:answers is the path and file name of the answer file.

Generally, storing answer files in the root of the Windows 2000 network share is the best practice. Then, to install Windows 2000 from \\Camelot\Win2000 with an answer file called Winnt.sif, the command looks like this:

winnt /s:\\Camelot\Win2000\i386 /u:\\Camelot\Win2000\Winnt.sif

Beyond the Basics

We've only just begun. The sample in Listing 1 is just enough to get you started. You can use it to automate large portions of the setup program, but not all of it.

An Enterprise-worthy answer file consists of much more than you've seen so far; you learn about those advanced techniques throughout this series. For example, you can deploy third-party device drivers with Windows 2000, or deploy additional files with Windows 2000, and even install applications such as Office 2000 as part of the setup process. Or, have the setup program generate a random computer name instead of prompting the user.

Building great answer files is only part of the story. You also have a command to deploy or, better yet, a disk image to deploy. In this series, you will learn how to deploy the command via Microsoft Systems Management Server, logon scripts, task scheduler, and even the Registry. You'll also learn how to build and deploy disk images using Symantec Ghost Enterprise and Remote Installation Service.

Stay tuned! //

Jerry Honeycutt is an author, speaker, and technologist with over 25 books to his credit. He successfully uses RIS in his own small office.

Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved