Jan 12, 2020 We will need two answer files: autounattend.xml to automate phase 1, Windows Setup. Unattend.xml to automate phase 3, OOBE. When done we will create a custom USB flash drive install media for unattended install. To install Windows 10 using this USB will be totally unattended, 'Hands Free'; simply boot from USB and forget it, take a break, come. Jun 24, 2021 You can use Unattend settings to prevent some or all of the user interface (UI) pages from appearing in Windows OOBE. To learn more about creating an answer file using Unattend, as well as a full list of Unattend settings available to you, see the Unattended Windows Setup Reference.
Unattended Windows installation is done via 'Answer Files', or 'Unattend files'.
These files are generally named 'autounattend.xml'. They are notPacker-specific tools, though we do make use of them.
If, after following this guide, you're still having issues getting an answerfile working, We recommend you read the official documentation onanswer files.
The guide here is hopefully enough to get you started, but isn't a replacementfor the official documentation.
»When To Use an Answer File
If you are installing the Windows Operating System from a mounted iso as part ofyour Packer build, you will need to use an Answer file. For example, you'rebuilding an image from scratch using the vmware-iso,virtualbox-iso, orhyperv-iso builders.
If you are not installing the operating system, you won't need to provide ananswer file. If you are using a pre-built imagein a cloud, you don't need to worry about Answer files.
»How to make an Answer File
You can either start from an example answer file from a known repo (take a lookat the examples links below), or you can generate one using an answer filewizard by selecting New File > New Answer file on a Windows machine.A comprehensive list of all the options you can set in an answer file can befound here
»Where to put the Answer File
Windows will automatically look for an autounattend.xml file on mounted drives.Many users use the floppy_files
option or a secondary mounted iso forproviding the answer file to their iso builders.
You can also specify an unattend file to use by using the /unattend: option whenrunning Windows Setup (setup.exe) in your boot_command
.
»What does Packer need the Answer File to do?
Packer needs the Answer File to handle any questions that would normally beanswered interactively during a Windows installation.
If you want to be able to use provisioners, the Answer file must also containa script that sets up SSH or WinRM so that Packer can connect to the instance.
Finally, your Packer build will be much smoother if the Answer File handles ordisables windows updates rather than you tyring to run them using a Packerprovisioner. This is because the winrm communicator does not handle thedisconnects caused by automatic reboots in Windows updates well, and thedisconnections can fail a build.
»Examples
Windows Unattend File Generator
The chef-maintained bento boxes are a great example of a windows build thatsets up openssh as part of the unattended installation so that Packer canconnect using the SSH communicator. They functioning answer files for everymodern Windows version can be found here.
Windows Unattend File System
Stefan Scherer's packer-windows repois a great example of windows builds that set up WinRM as part of the unattendedinstallation so that Packer can connect using the winrm communicator: