Dela via


Methods for Running Windows Setup

Applies To: Windows 7

Note

This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

Windows® Setup can perform Windows installations by using interactive or automated installation methods.

Interactive Windows Installation

In this method, a user must select where to install Windows, read and accept the Microsoft® Software License Terms, and apply a product key.

This method is useful for small-scale rollouts or individual installations. By using the default image from Microsoft, interactive Windows Setup does not require any preparatory work, such as creating answer files or capturing Windows images. It is possible to use interactive Windows Setup in conjunction with creating and capturing custom Windows images.

You can interactively install or upgrade Windows by using the Windows product media or from a network location after you store and share the installation files from the Windows product media. Interactive setup requires input from users, including selecting destination drive, user names, and time zones.

Automated Windows Installation

In this method, also called an unattended installation, Windows Setup works with an unattended installation answer file to automate the installation and customization of Windows. This method is useful for large-scale rollouts and for achieving consistency and precision in the configuration of each computer.

Automated installation requires the creation of one or more answer files containing customizations for an installation. For example, you can change the Internet Explorer® home page settings, hard disk configurations or Windows Firewall. For information about creating answer files with Windows System Image Manager (Windows SIM), see the Windows System Image Manager Technical Reference.

There are two ways that Windows Setup applies answer files: explicitly specifying an answer file or implicitly searching for an answer file.

Explicitly Specifying an Answer File

You can explicitly specify an answer file by using the setup.exe command with the **/unattend:**filename option.

In this example, filename is the local or UNC path for the answer file. For more information, see Windows Setup Command-Line Options.

This answer file is used to configure the Windows installation. Because reboots are required during Setup, a copy of this answer file is cached to the %WINDIR%\Panther directory of the Windows installation.

Implicitly Searching for an Answer File

If an answer file is not specified, Windows Setup automatically searches for an answer file in several locations. By having Windows Setup automatically use an answer file during installation, you can facilitate your preinstallation process.

The locations include a previously cached answer file, an answer file at the root of a drive, and other locations. The complete list of valid search paths is listed in the Implicit Answer File Search Order section later in this topic.

Windows Setup automatically searches for an answer file every time a configuration pass starts.

There is an order of precedence when Windows Setup searches for an answer file. If an answer file is found in one of the valid locations, it must include a valid configuration pass. If an answer file is found and it includes no settings for the given configuration pass that is running, that answer file will be ignored.

Note

By default, answer files are named Unattend.xml. However, because some answer files include destructive actions such as disk partitioning, you must rename your Unattend.xml file to Autounattend.xml to configure Windows Setup to implicitly detect and use the answer file. You typically use the Autounattend.xml file when you use the Windows Setup DVD boot method and supply an answer file on a USB flash drive (UFD) or other removable media device.

Implicit Answer File Search Order

Windows Setup identifies and logs all available answer files based on the search order. The answer file with the highest precedence is used. The answer file is validated and then cached to the computer. Valid answer files are cached to the $Windows.~BT\Sources\Panther directory during the windowsPE and offlineServicing configuration passes. After the Windows installation is extracted to the hard disk, the answer file is cached to %WINDIR%\panther.

The following table shows the implicit answer file search order.

Search Order Location Description

1

Registry

HKLM\System\Setup\UnattendFile

Specifies a pointer in the registry to an answer file. The answer file is not required to be named Unattend.xml.

2

%WINDIR%\Panther\Unattend

The name of the answer file must be Unattend.xml or Autounattend.xml.

Note
Windows Setup searches this directory only on downlevel installations. If Windows Setup starts from Windows PE, the %WINDIR%\Panther\Unattend directory is not searched.

3

%WINDIR%\Panther

Windows Setup caches answer files to this location to be used in subsequent stages of installation. For example, when a computer reboots, Setup can continue to apply the settings in an answer file. If you explicitly specify an answer file with Windows Setup or Sysprep, the answer file cached to this directory is overwritten with the explicitly specified answer file.

Important

Do not use, modify, or overwrite the answer file in this directory. The answer file in this directory is annotated by Windows Setup during installation. This answer file cannot be reused in Windows SIM or any other Windows installations.

4

Removable read/write media in order of drive letter, at the root of the drive.

Removable read/write media in order of drive letter, at the root of the drive.

The name of the answer file must be Unattend.xml or Autounattend.xml, and the answer file must be located at the root of the drive.

5

Removable read-only media in order of drive letter, at the root of the drive.

Removable read-only media in order of drive letter, at the root of the drive.

The name of the answer file must be Unattend.xml or Autounattend.xml, and must be located at the root of the drive.

6

windowsPE and offlineServicing configuration passes:

  • \Sources directory in a Windows distribution

All other passes:

  • %WINDIR%\System32\Sysprep

In the windowsPE and offlineServicing configuration passes, the name of the answer file must be Autounattend.xml.

For all other configuration passes, the file name must be Unattend.xml.

7

%SYSTEMDRIVE%

The answer file name must be Unattend.xml or Autounattend.xml

Important

Because answer files are cached to the computer during Windows Setup, your answer files will persist on the computer between reboots. Before you deliver the computer to a customer, you must delete the cached answer file in the %WINDIR%\panther directory. There might be potential security issues if you include domain passwords, product keys, or other sensitive data in your answer file. However, if you have unprocessed settings in the oobeSystem configuration pass that you intend to run when an end user starts the computer, consider deleting the sections of the answer file that have already been processed. One option might be to use a separate answer file when you run sysprep /oobe that only contains settings in the oobeSystem configuration pass.

Sensitive Data in Answer Files

Setup removes sensitive data in the cached answer file at the end of each configuration pass.

However, if an answer file is embedded in a higher precedence location than the cached answer file, then the cached answer may be overwritten at the beginning of each subsequent configuration pass, if the embedded answer file matches the implicit search criteria. For example, if an answer file is embedded at %WINDIR%\Panther\Unattend\Unattend.xml, the embedded answer file will replace the cached answer file at the beginning of each configuration pass. For example, if the embedded answer file specifies both the specialize and oobeSystem configuration passes, then the embedded answer file is discovered for the specialize configuration pass, cached, processed, and sensitive data is cleared. The embedded answer file is discovered again during the oobeSystem configuration pass and cached again. As a result, the sensitive data for the specialize configuration pass is no longer cleared. Sensitive data for previously processed configuration passes will not be cleared again. Unless the cached answer file must be overridden, we recommend that answer files be embedded at a location that has a lower precedence.

Important

Because answer files are cached to the computer during Windows Setup, your answer files will persist on the computer between reboots. Before you deliver the computer to a customer, you must delete the cached answer file in the %WINDIR%\panther directory. There might be potential security issues if you include domain passwords, product keys, or other sensitive data in your answer file. However, if you have unprocessed settings in the oobeSystem configuration pass that you intend to run when an end user starts the computer, consider deleting the sections of the answer file that have already been processed. One option might be to use a separate answer file when you run sysprep /oobe that only contains settings in the oobeSystem configuration pass.

You can add a command to the Setupcomplete.cmd command script that deletes any cached or embedded answer files on the computer. For more information, see Add a Custom Script to Windows Setup.

Windows Setup Annotates Configuration Passes in an Answer File

After a configuration pass is processed, Windows Setup annotates the cached answer file to indicate that the pass has been processed. If the configuration pass is run again and the cached answer file has not been replaced or updated in the interim, the answer file settings are not processed a second time. Instead, Windows Setup will search for implicit Unattend.xml files that are at a lower precedence location than the cached Unattend.xml file.

For example, you can install Windows with an answer file that contains RunSynchronous commands in the specialize configuration pass. During installation, the specialize configuration pass runs and the RunSynchronous commands execute. After installation, run the sysprep command with the /generalize option. If there is no answer file in a higher precedence than the cached answer file or an answer file was not explicitly passed to the Sysprep tool, Setup runs the specialize configuration pass the next time the computer boots. Because the cached answer file contains an annotation that the settings for that configuration pass were already applied, the RunSynchronous commands do not execute.

Implicit Answer File Search Examples

The following examples help describe the behavior of implicit answer file searches.

Answer Files Named Autounattend.xml Are Automatically Discovered by Windows Setup
  1. Create an answer file named Autounattend.xml that includes settings in the windowsPE configuration pass.

  2. Copy Autounattend.xml to a removable media device.

  3. Configure the BIOS of your computer to boot from CD or DVD.

  4. Boot the Windows product DVD.

  5. Insert the removable media device while Windows is booting. This example assumes that the removable media is assigned the drive letter D:\.

    Windows Setup starts and automatically identifies Autounattend.xml as a valid answer file. Because the answer file uses a valid file name (Autounattend.xml), is located in one of the valid search paths (the root of D), and includes valid settings for the current configuration pass (windowsPE), this answer file is used.

    The answer file is cached to the computer. If there are no additional answer files discovered in later passes, the cached answer file is used throughout Windows Setup.

Answer Files Are Discovered In Order Of Precedence in Predefined Search Paths
  1. Install Windows with an answer file by using the steps in the previous scenario. The answer file used to install Windows is cached to the system in the %WINDIR%\Panther directory.

  2. Copy an Unattend.xml file to the %WINDIR%\System32\Sysprep directory.

    This answer file has settings in the generalize configuration pass.

  3. Run the sysprep command with the /generalize option to create a reference image.

    Because the %WINDIR%\System32\Sysprep directory is in the implicit search paths, the answer file copied to this directory is found. However, an answer file that was used to install Windows is still cached on the computer and contains settings for the generalize configuration pass. This cached answer file has a higher precedence than the one copied to the Sysprep directory. The cached answer file is used.

Note

The Sysprep tool can be run as a command-line tool or as a GUI tool. If you run the Sysprep tool as a GUI tool, you can select the Generalize check box.

To use the new answer file, you can copy it to a directory of a higher precedence than the cached answer file, or you can specify the answer file by using the **/unattend** option. For example:  
  

    sysprep /generalize /unattend:C:\MyAnswerFile.xml
Answer Files Must Include a Valid Configuration Pass
  1. Copy an Unattend.xml file to a removable media device.

    The Unattend.xml file has settings only for the auditSystem and auditUser configuration passes.

  2. On an installed Windows operating system, run the sysprep /generalize /oobe command.

    Even though the answer file is available in one of the implicit search paths, the Unattend.xml file is ignored because it does not contain a valid pass for the generalize configuration pass.

See Also

Concepts

How Windows Setup Works