- Docker logs tail: Troubleshoot Docker containers with real-time logging - Wed, Sep 13 2023
- dsregcmd: Troubleshoot and manage Azure Active Directory (Microsoft Entra ID) joined devices - Thu, Aug 31 2023
- Ten sed command examples - Wed, Aug 23 2023
A newer approach than answer files is cloning an existing installation by writing it to a WIM archive. After generalizing the reference installation with sysprep, capture it using DISM (see Create a customized Windows 10 image using PowerShell and Hyper-V). But some admins still prefer an automated setup with answer files, because it usually results in a cleaner installation of Windows Server.
Installing Windows Server 2022
Windows Server 2022 supports an answer file similar to previous versions of the operating system. It intuitively provides "answers" to the typical questions that the installer prompts during a manual setup. Building the answer file would not be an easy undertaking if you were to write the XML file manually. However, with the Windows Assessment and Deployment Kit (ADK), Microsoft provides the necessary tools.
Hence, you first have to install the Windows Assessment and Deployment Kit. It contains the tool we need to write an answer file: the Windows System Image Manager (WSIM). You want to grab the latest download of the ADK, as you need the latest version to "understand" the latest Windows Server 2022 build (download ADK).
Installing the ADK is a simple "next, next, finish" process. On the Select the features you want to install screen, I have checked Deployment Tools, among others. They contain WSIM.
Extract Install.wim for Windows Server 2022 Preview
Now that we have the ADK installed, you will need to download the Windows Server 2022 Preview media. It is available for download in the official Microsoft Preview center here. Select the ISO file for download.
Once you download the ISO, mount this in Windows, and copy the install.wim from the Sources folder to a writeable folder for WSIM.
Mount Install.wim in WSIM
Once installed, you can launch the WSIM. This tool provides the GUI to work with and create answer files for Windows Server and client. To get started with Windows Server 2022, note the Select a Windows image or catalog file option under Windows Image. Right-click this and choose Select Windows Image…
Select the specific Windows Server 2022 image for creating an answer file.
Answer Yes to the prompt to create a catalog file.
After the catalog process is complete, right-click the Create or open an answer file option and select New answer file.
Now you see the various components or stages of the installation created for customization. These include:
- 1 windowsPE
- 2 offlineServicing
- 3 generalize
- 4 specialize
- 5 auditSystem
- 6 auditUser
- 7 oobeSystem
How do you know which sections to add? When you drag a component from the Windows Image pane to the answer file, WSIM will only allow you to drop it to the appropriate stages of the setup process. Also, in the context menu of every component, all incompatible passes are grayed out.
If you already have an answer file for Windows Server 2019, you can use it as a template for Windows Server 2022, as there are few differences.
Below, you see the first two components in the image of the sample answer file shown. These are:
- Microsoft-Windows-International-Core-WinPE
- Microsoft-Windows-Setup
Below, I have added the answer file section to choose the UILanguage and set this to English US.
Below, I have added the Microsoft-Windows-Setup_neutral section to add the disk and partition configuration for the automated deployment of Windows Server 2022.
After you have configured the settings you want for your automated deployment of Windows Server 2022, navigate to File > Save Answer File, which prompts you for a location to save the file. In many cases, the name needs to be autounattend.xml.
Using this process with the WSIM, you step through each section you want to add to your configuration. I like WSIM because it has dropdown boxes for each property element for each section, so you are not left guessing what valid options are available. If you want to download and view a full sample Windows Server 2022 answer file for automated deployment, you will find the answer file here.
Wrapping up
Building a Windows Server 2022 answer file is made easy with the latest version of the Windows Assessment and Deployment Kit, which provides the tools to write the XML answer file using a GUI interface.
Subscribe to 4sysops newsletter!
As shown, using the WSIM GUI tool, you can add each section of the deployment and build the answer file without worrying about XML syntax and formatting.
I had to make the install.win file writable as well. Copying it from the ISO, it had the read-only attribute set on it.