Windows Server 2022 unattended install with xml answer file

I'm trying to automate the Windows Server 2022 Installation by using an answer file.

I have created the following answer file for Windows Server 2022 in Windows System Image Manager:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
        <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <InputLocale>0407:00000407</InputLocale>
            <UserLocale>de-DE</UserLocale>
            <SetupUILanguage>
                <WillShowUI>Never</WillShowUI>
            </SetupUILanguage>
        </component>
    </settings>
    <cpi:offlineImage cpi:source="wim:c:/users/xxx.xxx/downloads/20348.169.210806-2348.fe_release_svc_refresh_server_eval_x64fre_en-us/sources/install.wim#Windows Server 2022 SERVERSTANDARDCORE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

I'm expecting this to automatically set the Keyboard input locale to german, and the time and currency setting to germany, and also not to show the locale selection UI.

I have then packed the unattend.xml file in an iso, so I can easily modify it without having to upload a 5GB ISO to the hypervisor (ESXI in this case). This iso is mounted for the VM I want to install Windows Server in, in addition to the installation iso.

When I'm booting the Windows Server 2022 ISO, I'm opening the console with Shift+F10, and then executing setup.exe /unattend:e:\unattend.xml. I have confirmed with type e:\unattend.xml that the file can be read correctly.

For some reason, the locale selection screen is still shown and the default values are selected (not the ones specified in my unattend.xml)

How can I get the Windows Server 2022 setup to correctly use the settings from the unattend.xml config?


Solution 1:

I have solved this and have a few observations:

1st: Naming the file Autoattend.xml leads to it being applied automatically, no need to use the /unattend option.

2nd: For some reason, InputLocale and UserLocale have no effect when UILanguage and SystemLocale are not set. Setting them to their respective default values fixes this.

3rd: If all options from 2nd are set, the WillShowUI option is not necessary.