One of the biggest time drains when deploying a new Windows client or server is installing Windows itself. The wizard that comes with the install forces you to set various configuration settings ahead of time so that Windows knows how to install the operating system. Let's automate this by performing a Windows unattended install.
The start of automating on a Windows machine is typically after the install process. After all, you've got to have a platform to automate on, right? Not really. In fact, if installing Windows from a WIM or ISO file, it's possible to completely automate the install step too using a single well-placed file.
Automating a Windows install requires a file called AutoUnattend.xml. Remember that name. It must be exactly that name when placed inside of the ISO. This is an XML file that can act as an install answer file answering each of those setup questions ahead of time, so you don't have to.
The first task is to create this file. Because this file must be structured in a specific way, it's always a good idea to start from a template. You can download an example template here to get started. This file is broken down into the different phases of a
- windowsPE (bootstrapping and disk configuration)
- specialize (setting computer name, users, etc.)
- oobeSystem (local administrator password, etc.)
If you'd like to start from scratch, another useful method of creating this template is with the Windows File Answer Generator. This is a website that provides a wizard-like interface to answer simple questions which will create an unattended XML file for you.
By either choosing to use an existing template or the Windows File Answer Generator site, it's most likely the template must be modified by hand.
Since the XML is strict about the structure and specific nodes, it's probable that the first version of your template will not work as expected. However, before we get into that, let's at least give the first version a try.
Inserting the Autounattend XML in the ISO
Once you have the AutoUnattend.xml file created, it's now time to insert it into the Windows ISO. Unfortunately, there's not an easy way to make this happen without third party tools. Options include WinISO or use a combination of extracting and creating a new ISO file with 7Zip. Either way, the process is not as automated as you might want to think, but as of this writing, I could find no other way.
Once you've decided on a method to insert a file into the ISO, it's now time to place the AutoUnattend.xml file into the root of ISO. There are a few other places this file can be placed but I've found it easier to put it in the root.
Start the Automated Install
When the file has been put into the root of the ISO, and a new ISO has been generated, it's now time to test it out. At this point, all the hard work is done. Just attach the ISO as a media drive in your virtualization platform of choice and start up the VM.
The only difference now is that you'll see instead of being prompted with
questions, the install will just run entirely hands off. Once complete, Windows will be installed, and any additional scripts or configuration you've applied will have been set!
Performing a Windows unattended install all comes down to creating a well-formed autounattend.xml. Using the example I've provided and the Windows File Answer Generator site, you should have everything you need to start automating Windows OS deployments in no time!
Join the Jar Tippers on Patreon
It takes a lot of time to write detailed blog posts like this one. In a single-income family, this blog is one way I depend on to keep the lights on. I'd be eternally grateful if you could become a Patreon patron today!Become a Patron!
Subscribe to Adam the Automator
Get the latest posts delivered right to your inbox