This topic contains information about advanced tasks that you can implement with Windows Deployment Services.

In This Topic

Passing Unattend Files to Setup by Using the Command Line

It is possible to pass an unattend file directly instead of obtaining the unattend file from the server. You can do this by passing /unattend:<unattend file> and /wds with Setup.exe (for example, Setup.exe /WDS /Unattend:X:\WDSClientUnattend.xml). If you are booting Windows PE by using a CD, DVD, or hard disk drive, you must also invoke the Windows Deployment Services client in discover mode by using the /WDSDiscover option. For more information about Windows Deployment Services mode, see the “When Setup Is Started in Windows Deployment Services Mode” section in How the Windows Deployment Services Client Works (http://go.microsoft.com/fwlink/?LinkID=147067). As is also the case when receiving the Windows Deployment Services client unattend file from the server, the unattend file that you passed by using the command line will be used only for the Windows PE phase. Settings corresponding to other unattended passes will be handled by the image unattend file. The following is an example scenario:

  1. A client computer boots into a version of Windows PE that contains the Windows Vista Setup files. The client boot can be performed over the network, from a CD or DVD, or from the hard disk drive.

  2. A custom application is invoked, which has a customized user interface (UI).

  3. The application detects the computer’s MAC address and contacts a database to get the correct unattend file.

  4. The application uses the Windows Deployment Services client (which is essentially Setup.exe and supporting files) to retrieve a list of available images that are stored on a Windows Deployment Services server, and then it displays this list to the user.

  5. The user selects an image.

  6. The application takes the selected image and inserts the appropriate data into the unattend file.

  7. The application invokes Setup.exe in Windows Deployment Services mode, and then it passes Setup.exe an unattend file.

  8. The installation proceeds.

Using Implicit Unattend Files

You can use implicit unattend files, which means that if an unattend file is not specified (through the command line or from the Windows Deployment Services server), the client searches for an unattend file in several locations. The most common scenario involves using a file called AutoUnattend.xml, which is at the root of removable media (such as a CD, DVD, or USB flash drive). For more information about implicit search paths, see Methods of Running Windows Setup at http://go.microsoft.com/fwlink/?LinkId=120686.

Embedding an Unattend File in an Image

In general, it is a best practice to store unattend files outside of the images with which they are associated. The main reason for this is flexibility; it is easier to modify an image that is on a file share on the Windows Deployment Services server than it is to mark an image offline, export the image, mount it, modify the unattend file, and then reimport the image. However, there are some cases where you may want to include the unattend file in a boot or install image. The following is an example of a scenario in which you may want to do this.

There are two types of computers in your organization — laptops and desktops. Your company policy states that all laptops should be configured with two partitions to support BitLocker Drive Encryption, and desktops should have a single partition and do not need BitLocker support. You create a custom boot image that is configured to run a simple script. The first action in the script is to use Windows Management Instrumentation (WMI) calls to determine whether a particular booted client computer is a laptop or a desktop.

  • If the computer is a laptop, the script calls Setup.exe by using the /wds option and then passes an Unattend.xml file for laptop use (one that creates two hard disk partitions).

  • If the computer is a desktop, the script calls Setup.exe by using the /wds option and then explicitly passes an Unattend.xml file for desktop use (one that creates only a single partition).

Understanding Unattend File Precedence

The following table outlines the precedence for unattend files. Note that you cannot change this precedence order.

Windows Deployment Services client unattend file Image unattend file

AWindows Deployment Services client unattend file that is defined always overrides an implicit unattend file. The order of precedence for this file is as follows:

  1. Unattend files that are passed explicitly from the command line (for example, setup.exe /wds /unattend:<unattend file>)

  2. Unattend files that are defined on the server

  3. An implicit unattend file (AutoUnattend.xml)

The order of precedence for this file is as follows:

  1. Explicitly assigned image unattend files (Windows Vista images only)

  2. Image unattend files in the $OEM$ structure

  3. Template unattend files (used as part of a domain join)

  4. Client unattend files that have been carried over into additional phases of unattend processing

Setting Command-Line Precedence for Image Unattend Files

There are installation scenarios in which you may want to use the same Unattend.xml file for automating the Windows Deployment Services client and subsequent phases of Setup when performing a custom deployment solution. Note that command-line precedence does not apply to Windows Deployment Services client unattend files that are obtained from the Windows Deployment Services server. By setting the command-line precedence value, you can specify whether another unattend file (either an implicit unattend file such as AutoUnattend.xml, or an unattend file passed by using the /Unattend option) will be used instead of the image unattend file when installing a client computer. To override an existing image unattend file associated with an image, first enable unattend installations by running the command wdsutil /set-server /wdsunattend /Policy:{Enabled | Disabled}. Next, run one of the following:

  • To allow an unattend file on the client computer to override the unattend file sent from the server, run WDSUTIL /Set-Server /WDSUnattend /CommandLinePrecedence:Yes.

  • To force the unattend file from the server to be used, run WDSUTIL /Set-server /WDSUnattend /CommandLinePrecedence:No.

The following is an example scenario:

There are two types of computers in your organization — laptops and desktops. Your company policy states that all laptops should be configured with two partitions and should contain the proper Bluetooth drivers and software. It also states that desktops should have a single partition and do not need Bluetooth support. Because the majority of the computers in your organization are desktops, you create a Windows Deployment Services client unattend file that creates a single disk partition. Then you create a Windows Vista image with an image unattend file that does not install the Bluetooth drivers and software. Next, you create a single Unattend.xml file that performs all of the custom actions needed for laptop installations. Finally, you create a custom boot image that is configured to run a script. The first action in the script is to use WMI calls to determine whether a booted client computer is a laptop or a desktop.

  • If the computer is a laptop, the script calls Setup.exe by using the /wds option and then explicitly passes the custom Unattend.xml file for laptop use. To ensure that this single unattend is used throughout the process, you set the command-line precedence value of the server appropriately. This action causes the unattend file that is passed to the Windows Deployment Services client through the command line to override the existing image unattend file that is associated with the image on the Windows Deployment Services server.

  • If the computer is a desktop, the script invokes the client normally, enabling the typical installation to continue (the client will obtain both the Windows Deployment Services client unattend file and, later, the image unattend file from the Windows Deployment Services server).

Using Variables to Obtain Information from the Client

The Windows Deployment Services client can obtain several pieces of information during an installation that you can use as part of your custom deployment scenario. The client will insert the proper variable valuess into your unattend file automatically as long as your file is formatted correctly. The variables that the client can use for this purpose are:

  • %USERDOMAIN%. The name of the user's domain, which was specified either by credentials or in the Windows Deployment Services client unattend file.

  • %USERNAME%. The user's name, which was specified either by credentials or in the Windows Deployment Services client unattend file.

  • %USERPASSWORD%. The user's password, which was specified either by credentials or in the Windows Deployment Services client unattend file. Using this variable may pose a security risk and is not recommended. The password value will be written to the unattend file in plain text.

  • %MACHINEDOMAIN%. The domain containing the computer account that represents the physical client computer.

  • %MACHINENAME%. The computer name of the computer account that represents the physical client computer.

  • %TIMEZONE%. The time zone of the Windows Deployment Services server.

  • %ORGNAME%. The organization name of the Windows Deployment Services server.

To see an example file that uses these variables, see Sample Unattend Files.