oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Automate Windows Installations

by Mitch Tulloch, author of Windows Server Hacks

Answer files are text files that contain the answers to various prompts Setup makes when installing Windows. By creating an answer file, you can automate the installation of Windows and make it a hands-free operation, saving time and simplifying deployment. Way back in the early days of Windows NT 4.0, administrators had to create their answer files from scratch (or tweak the sample unattend.txt file provided on the Windows NT 4.0 product CD) using a text editor like Notepad. Windows 2000 changed things by providing a support tool called Setup Manager found in the \Support\Tools\ folder on the Windows 2000 product CD. Using Setup Manager you can easily create new answer files by stepping through a wizard, or you can open existing answer files and modify them according to your needs. Windows XP and Windows Server 2003 contain updated versions of Setup Manager that function similarly. (Always use the version of Setup Manager for the latest version of your operating system/service pack combo.)

The problem is that when administrators use answer files to deploy a lot of Windows machines on their networks, they often end up with a collection of different answer files for different purposes--depending on whether they are installing workstations or servers, assigning different server roles, deploying machines across different subnets or domains, or installing different versions of Windows. The result is answer file hell, a counterpart to the old DLL hell that used to plague users of earlier versions of Windows when they installed a surplus of third-party applications.

Another problem with managing answer files is that while Setup Manager can be used to easily create new answer files from scratch, this tool isn't perfect. In fact, Setup Manager doesn't support configuring a number of important settings that may be needed for customizing deployments--particularly in enterprise environments--so you're likely to end up needing to edit your answer files manually anyway using Notepad after you create them using Setup Manager. Also, walking through the steps of the Setup Manager wizard can sometimes be a slower process than using Notepad to tweak an existing answer file.

Using Templates

Related Reading

Windows Server Hacks
100 Industrial-Strength Tips & Tools
By Mitch Tulloch

As a result of the limitations, many administrators prefer to use templates instead of Setup Manager. A template is simply a previously created answer file that you can edit to suit your needs. One advantage of building a library of answer file templates is that you can benefit from regression testing. First you create a basic answer file using Setup Manager; then you customize it using Notepad for settings Setup Manager can't configure; and then you test the file in a lab environment. Once you have a working answer file, you can reuse it without worry of anything going wrong, and you can use it as a template to create modified versions that you can be sure will work also.

The key to effectively working with answer file templates is to strip out everything extraneous from the templates and keep them as short as possible--a dozen or so lines is usually enough. A fully working answer file for automated deployments of Windows actually requires only five sections, namely:

  • [Unattended] contains keys telling Setup to skip the EULA, how automated Setup should run, the location of the %windir% folder, and so on.
  • [GuiUnattended] contains keys specifying the local Administrator password and the time zone, skipping the Welcome page and the Regional Options page, and so on.
  • [UserData] contains keys specifying the computer name, the user and organization names, and the product key.
  • [Identification] contains keys specifying the settings that are needed if you want to join your new machine to a domain.
  • [Networking] is required if you need to configure network protocols, clients, and services during Setup.

So working with such short answer files is not really much hassle even if you use Notepad.

Of course, if you've got a lot of different automated deployment scenarios in your environment, then you probably need a better text editor than Notepad. One possible third-party replacement is UltraEdit; another good one is TextPad. Both of these powerful text editors include macros to simplify making block modifications to your answer files, syntax highlighting to help you catch keyword errors, and many other features. (For a look at other excellent text editors, see the WindowsDevCenter article Perfect Text Editors for Coders.

Another possibility is to use Microsoft Word to create answer files. Its built-in versioning feature can help you keep track of earlier versions of your answer files and revert to them if needed. Word also lets you add comments to your answer files so you can annotate them to document what they do. And you can turn on Track Changes to see what modifications you are making when you customize an answer file for a new deployment. You can even create a custom dictionary for Word to help you spell-check your answer files more easily. And once you've made your changes, you can save your answer file as both .txt and .doc files so you have a working version and a documented version, storing them on the same network share.

The template approach does have a couple of drawbacks, though. The main one is that if you want to include encrypted passwords for your local Administrator account, you must generate these using Setup Manager. And if you want to clone the configuration of a specific machine to other boxes using unattended deployment, Setup Manager is the preferred way to go, since you can use this tool to capture the existing configuration of your base machine into an answer file and then use it for cloning purposes. In most cases, however, the template approach has significant advantages over Setup Manager, especially in large enterprise environments.


Once you've built up your library of regression-tested answer files, you can use them with confidence for your deployments. Just be sure to keep your library pruned by deleting any old answer files that are no longer needed. By maintaining a library of answer files like this, you can greatly ease the job of deploying new machines on your network.

Mitch Tulloch is the author of Windows 2000 Administration in a Nutshell, Windows Server 2003 in a Nutshell, and Windows Server Hacks.

Return to the Windows DevCenter.