Installing Windows 10 is done in three phases:
- Boot from install media, run Windows Setup (when done, restart is required)
- Configure hardware devices (one restart during, one restart when done)
- Windows Welcome (OOBE)
In normal clean install, user interaction is required in phases 1 and 3, phase 2 being run automatically without user interaction. In phase 1 user selects language and keyboard layout settings for setup process and system accounts, enters product key for specific edition or selects edition manually and accepts license if product key is not entered at this stage, and selects disk and partition to install Windows. When phase 1 is done, Windows restarts to phase 2 which is done without user interaction and when ready automatically restarts to phase 3.
In phase 3 user selects region and language settings for user accounts, creates initial admin user account, chooses OneDrive, privacy and other account settings and finally boots to desktop.
To fully automate Windows 10 installation, to create install media for a “hands free” Boot & Forget installation, we need to prepare so called answer files for both Windows Setup (phase 1) and Windows Welcome (OOBE, phase 3). Read Understanding Answer Files on Microsoft Docs, an old but still valid article to explain what answer files are and what they do.
In this post we will create an answer file called autounattend.xml which, when added to root of install media (ISO, USB, DVD) will take care of Windows system accounts region and keyboard selection, accepts license, wipes the hard disk clean, re-partitions it as user prefers, and finally starts Windows Setup. This post is quite long and might look as complicated if you have never done this, but let me assure you the procedure is fast and easy. I just wanted to make instructions clear enough for anyone to follow. I usually need about three minutes to do everything what’s told in this post, to create autounattend.xml answer file (timed it now to be sure!)
Windows SIM (System Image Manager)
WSIM is part of Windows 10 ADK (Assesment and Deployment Kit). To start creating answer files, download the latest WADK: https://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install
If you are working with Windows Insider builds, download WADK Insider Preview instead: https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewADK
You can of course install each and every component of WADK if you so prefer, but to create answer files and custom ISO images, we will only need Deployment Tools:
When installed, you can find WSIM in Start > W > Windows Kits > Windows System Image Manager.
Launch WSIM. The GUI has five panels:
- Distribution Share
- Windows Image
- Answer File
In this example, we will work with panes 2 through 5. To start with, we need to create a catalog file. A catalog file with extension .clg is a binary file, containing the settings for a specific Windows edition. Catalog files are not required to install Windows, but they are essential when creating an answer file. A catalog file can be created using a Windows 10 install.wim file.
To create a catalog file, copy install.wim file from a valid Windows 10 install media to hard disk or a USB flash drive (catalog file cannot be created from write protected WIM file). Select File > New Answer File, Click Yes and browse to the install.wim file:
To start creating a new catalog file, click Yes:
WSIM will now create a catalog file. Note that this will take some time, on my ancient Asus i5 laptop it takes around 15 minutes, on a bit younger HP laptop almost 10 minutes. If using WADK / WSIM Insider Preview, notice that a minor bug might cause you seeing this:
The catalog file was created, whatever the error message says. Just click Continue and repeat the process selecting File > New Answer File, and this time browsing to and selecting the catalog file instead of WIM file:
Catalog files are created in same folder where the original install.wim file is locatedd. They are reusable, you only need to create catalog file once, to work with additional answer files you can simply select the catalog file instead of creating a new one from a WIM file.
Add components to autounattend.xml answer file
On Windows Image pane bottom left, expand Components. Right click Microsoft-Windows-International-Core-WinPE, add it to configuration Pass 1 WindowsPE:
Next, expand Microsoft-Windows-Setup on Windows Image pane. Add component DiskConfiguration to Pass 1 by right clicking DiskConfiguration and selecting Add Setting to Pass 1, expand ImageInstall > OSImage component and add InstallTo to Pass 1, add UserData domponent to Pass 1:
The Answer File pane at top middle should now look like this when all components have been expanded:
Regional and language settings
Let’s first add Windows UI (display) language, installation language and keyboard layout. Select Microsoft-Windows-International-Core-WinPE on Answer File pane, edit properties as preferred on Properties pane top right. In my case I want to install UK English Windows 10, using Finnish keyboard layout (input language) which allows me to type in both my native languages Finnish and Swedish, as well as in English and German which I also need on daily basis:
InputLocale value for a Finnish keyboard is 040b:0000040b, everything else is set to UK English (SystemLocale, UILanguage, UILanguageFallback, UserLocale). Here’s a short list of some other InputLocale and language codes:
- Brazil – Portuguese > 0416:00000416, pt-BR
- Canada – English > 1009:00000409, en-CA
- Canada – French > 0c0c:00011009, fr-CA
- France – French > 040c:0000040c, fr-FR
- Germany – German > 0407:00000407, de-DE
- UK – English > 0809:00000809, en-GB
- USA – English > 0409:00000409, en-US
For a complete list of such information, please visit: Default Input Profiles (Input Locales) in Windows
About UILanguageFallback: it is the language used for resources, notifications and system messages that are not localized (translated) into the current Windows system language. US English (en-US) can be used as a Fallback language in every language version of Windows, and should be used for all partially localized versions. Arabic (ar-SA) and Chinese Hong Kong (zh-HK) are exceptions. In addition to en-US in Arabic, the fallback language can also be French (fr-FR) and in Chinese, it can also be Hong Kong Chinese Taiwan (zh-TW).
OK, out next step is to tell Windows Setup the language for the install media. Expand Microsoft-Windows-International-Core-WinPE in the Answer File pane, then select SetupUILanguage, and set properties for the UILanguage as you like. In my case, after installing UK English Windows 10, I set it to EN-GB, where the first two letters identify the language, and the last two identify its regional version:
Notice that Microsoft has elected to show languages as xx-YY where lower case xx is the language and upper case YY is the region. However, this value is not case sensitive. Thus, even something such as eN-gB would be accepted and would work OK. I am used to using upper-case letters for both parts of the language ID myself. You can do as you like!
Partitioning the hard disk
Right click DiskConfiguration under Microsoft-Windows-Setup in the Answer File pane, then select Insert New Disk:
Next, select the new disk in the Answer File pane, and edit its properties. DiskID tells Windows Setup which disk to use to install Windows, where DiskID 0 is the primary hard disk (DiskID 1 = second HDD, and so on). Setting the WillWipeDisk value to TRUE tells setup to wipe the disk. This is the same as executing a DISKPART > SEL DISK 0 > CLEAN operation:
Now, onto the disk partitions. Creating install media for a GPT partitioned / UEFI system, we need to create four partitions (WinRE, EFI, MSR, Windows). For an MBR / BIOS system, we create only two partitions (System Reserved, Windows). Right-click CreatePartitions, then select Insert New CreatePartition:
Repeat this step to create four partitions for GPT / UEFI install media or two partitions for MBR / BIOS install media.
This only creates these partitions. To tell Windows Setup what each partition is and how it should be setup and formatted, we must add ModifyPartition to each partition added above. Right click Modify Partitions in the Answer File pane and select Insert New ModifyPartition:
Repeat this step until you have one ModifyPartition for each CreatePartition.
Now, one by one, select a CreatePartition on Answer File pane and edit its properties as shown in the following table:
Here’s a screenshot from my system, that shows how you should edit properties for the first partition on GPT / UEFI install media:
To edit CreatePartition values for an MBR disk:
The value Extend = TRUE for partition 4 (GPT disk) or partition 2 (MBR disk) (the Windows partition), tells the system to use all available space on the hard disk for a single Windows partition after all the other necessary system partitions have been created. Should you wish to create additional data partitions, you’ll need to set a specific size for the Windows partition and then add additional partitions (now or later). Only the last/rightmost partition can be set to to extend.
Next, we need to edit ModifyPartition properties for each CreatePartition as shown in the following table:
GPT partition properties
Notice that the small 16 MB Partition 3 (GPT disk), MSR or Microsoft Reserved Partition is neither formatted nor labeled. Here’s a screenshot of an example ModifyPartition, showing properties for the WinRE partition:
ModifyPartition values for MBR disk:
MBR partition properties
Notice that when setting up an MBR disk, one more property is required make that partition active. This should be partition 1, the System Reserved partition.
To create more partitions, just create additional data partitions setting the EXTEND value for that Windows partition to FALSE, and assign it a specific size. Only the last partition on a disk can be set to EXTEND = TRUE, to use all available space left after creating other partitions.
Here’s an example using the answer file for a GPT disk. We want to create a 128 GB (131,072 MB) Windows partition, a 200 GB (204,800) Data partition, and then use the rest of the HDD for a Games partition. In that case, we would need to create six CreatePartitions and six ModifyPartitions and set properties for each one as follows:
GPT partitions (additional Data partitions)
ModifyPartition values for those six partitions would then be as shown in the next table:
GPT partition properties (additional partitions)
PLEASE NOTICE: The above table GPT partition properties (additional partitions) might not show correctly if using any other browser than Edge or Chrome. While I am inspecting this, in case table values are not shown, click here to view it as an image in new tab.
It is important to understand and remember that for each partition, we need one CreatePartition to create the partition, and one ModifyPartition to set its properties:
The last part of partitioning is to tell Windows Setup where to install Windows. Expand Microsoft-Windows-Setup > ImageInstall > OSImage in the Answer File pane, then select InstallTo. Set its properties: DiskID = 0 (if installing to the primary hard disk), PartitionID = 4 (GPT / UEFI) or PartitionID = 2 (MBR / BIOS):
User Data & Product Key
Here’s how to set the Microsoft-Windows-Setup > UserData properties: AcceptEula = TRUE, FullName = Any name (optional, can be left empty), Organization = Any name (optional, can be left empty):
The last thing an answer file needs is a product key. You can use any volume licensing key if one is available, or simply a generic key. If you use a generic key, Windows will be automatically activated when installed if the machine has a valid, existing digital license for that specific Windows 10 edition. If not, activation must be peformed manually with a valid product key sometime after installation is completed.
Expand Microsoft-Windows-Setup > UserData, select ProductKey. Enter a key:
Here are some generic product keys you can use in an autounattend.xml answer file:
- Windows 10 Home Single Language: 7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH
- Windows 10 Home: TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
- Windows 10 Pro: VK7JG-NPHTM-C97JM-9MPGT-3V66T
Note that generic keys may only be used for installation. Windows 10 cannot be activated with a generic key.
OK, now the answer file is ready. Next, you must validate it to see if it contains any errors:
Check the Messages pane at the bottom middle. If there are no warnings, save your answer file as autounattend.xml (File > Save As).
That’s it! When this answer file is stored at the root of the Windows 10 install media, Windows Setup needs no user interaction. It partitions the hard disk and installs Windows as instructed in autounattend.xml.
In next part of this series we will create an answer file to automate the Windows Welcome (OOBE). Stay tuned!
Author: Kari Finn
A Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.