Best Practices for Authoring Answer Files
Applies To: Windows 7, Windows Server 2008 R2
This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.
This section covers recommendations for authoring unattended installation answer files.
Always Validate Answer Files in Windows SIM
The recommended way to author answer files is to create them in Windows® System Image Manager (Windows SIM). However, if you use a manually authored answer file, you must validate the answer file in Windows SIM to verify that the answer file works.
Because available settings and default values can change from time to time, you must revalidate your answer file when you reuse it.
Legacy answer files from Windows® XP, Windows Server® 2008, or Windows Vista® do not work in Windows® 7 or Windows Server® 2008 R2. However, legacy answer files from Windows Vista® may work in Windows 7 and Windows Server® 2008 R2 after changing the settings noted in Changes in Unattended Setup Settings from Windows Vista and Windows Server 2008 in the Windows® Unattended Setup Reference.
Avoid Unnecessary Settings
You can introduce unnecessary settings by inserting a setting's parent node into the answer file.
Windows SIM does not create an empty setting in an answer file. Although unnecessary settings are ignored, they do cost time to parse. Therefore, as you author your answer file, remove any settings that are not required.
In general, it is best to expand down to the lowest level of a component and select only those elements that you intend to set. For the default value, there is no need to include the element unless it is a required element.
Understand Configuration Passes
Configuration passes represent different phases of installation. Understanding what happens during each configuration pass is critical to creating answer files. Review Methods for Running Windows Setup and How Configuration Passes Work.
Avoid Creating Empty Elements
Windows SIM supports creating empty elements in an answer file. By right-clicking a string setting type and selecting Write empty string, you create an empty element in the answer file. However, some settings support empty elements, and some do not. In some cases, creating an empty element causes Windows Setup to fail. Before creating an empty element, refer to the component setting documentation in the Windows® Unattended Setup Reference.
Do not overwrite existing files when using Data Images or $OEM$ Folders
When you add data, such as additional drivers or applications, do not overwrite Windows system files. Overwriting system files can corrupt your computer. For information on adding drivers and applications, see Create a Data Image and Add Applications, Drivers, Packages, Files, and Folders in the Windows® OEM Preinstallation Kit (Windows OPK) User's Guide or Windows® Automated Installation Kit (Windows AIK) User's Guide.
Deploying to Multiple Architecture Types
Create separate answer files for each architecture type you intend to deploy to. If a single answer file contains multiple components that apply to different architecture types, the component settings may be applied more than once or may be applied incorrectly.
Using Multiple Answer Files
You can use multiple answer files (Unattend.xml) to create different sets of customizations that you can apply to your images at different times. For example, you can use a generic answer file that contains your branding and support information during Windows Setup. After installation completes, when you run the Sysprep tool, you can apply a second answer file to add additional customizations.
You can use answer files with Windows Setup, Sysprep, and the Deployment Image Servicing and Management (DISM) tool. For example, to customize Windows Firewall settings, you can create an answer file to use with Sysprep. In audit mode, run the following command: sysprep /generalize /unattend:answerfile. This command generalizes the computer by removing system-specific information. Because you included a new answer file, this answer file is cached to %WINDIR%\Panther, overwriting any existing answer file. Windows Setup applies the settings in the new answer file during the generalize configuration pass. The next time the computer boots and runs the specialize configuration pass, settings in the specialize section of the new answer file are applied.
For more information about using an answer file with Windows Setup, see Methods for Running Windows Setup.
For more information about using an answer file with Sysprep, see Using Answer Files with Sysprep.
For more information about using an answer file with DISM, see Unattended Servicing Command-Line Options.
Adding Updates to a Windows Image
Use only the Microsoft-supported servicing mechanisms to update a Windows image.
Use DISM to update an offline Windows image. For more information, see Phase 5: Managing and Servicing Your Windows Image.
Use the OCSetup tool (Ocsetup.exe) to update a running Windows installation.
During installation, you can also configure the computer to automatically download updates from Windows Update.
Additional Microsoft-provided servicing technologies can include system management software (SMS) or Windows Server Update Services (SUS).
Never overwrite Windows system files by using $OEM$ Folders or data images.
If you have additional device drivers to add to a computer, add these drivers offline by using DISM. You can also include additional drivers in an unattended installation by using the Microsoft-Windows-PnPCustomizationsNonWinPE and Microsoft-Windows-PnPCustomizationWinPE components. For more information, see Add and Remove Drivers Offline.
Specify Language Settings
To change languages by using an answer file, use the Microsoft-Windows-International-Core-WinPE component. There are two components in which you can specify language settings:
Microsoft-Windows-International-Core-WinPE. Language settings applied during the windowsPE configuration pass.
Microsoft-Windows-International-Core. Language settings applied during the specialize or oobeSystem configuration pass.
Because some languages require a restart, we recommend that you configure your language settings during the windowsPE configuration pass because the computer will always restart. If you process language settings during the specialize or oobeSystem pass, the computer might require an additional restart.
Use the Sysprep/generalize Command with LocalAccounts to Change Account Information
You can use the sysprep command with the generalize option and the LocalAccounts settings to change account information about an existing user account.
If you specify the settings in the following example in the specialize configuration pass, all the values of
NEWVALUE will be changed. However,
MyAccount will retain its security group memberships.
MyAccount is considered to be the same account with a different display name, description, and password value.
<LocalAccount> <Name>MyAccount</Name> <DisplayName>NEWVALUE</DisplayName> <Description>NEWVALUE</Description> <Password> <PlainText>false</PlainText> <Value>NEWVALUEBASE64</Value> </Password> </LocalAccount>
For more information about using the Generalize command, see Prepare to Capture an Image for Deployment (Generalize).