Avoid some Windows setup instructions when using Packer

Hi,

I’m using packer to build an Windows image from a json file that has some settings in terms of CPU’s, hypverisor, reference to the autounattend.xml file etc.

My goal is to make packer build an image that installs Windows and goes through all the necessary steps in the installation.

When installing Windows Server 2022, all steps are passed except one which is the “Activate Microsoft Server Operating system Setup” where I have to manually click on “I don’t have a product key” and the it continues the installation and provisioning. Is there any way I can avoid this in my packer json file or in the autounattend.xml? (Because I have dism oneliner in autounattend.xml to add the license key but it will run later after that GUI step)

When installing Win 10, similar thing where I have to choose “Windows 10 Pro” from a list to continue the installation. Then following that, there are 3 more questions: Is this region right, keyboard layout, add a second keyboard layout.

I have the license key and Windows name(Windows 10 pro and Windows Server 2022) in the autounattend.xml file, as well as some language tags like this: GOAD/packer/vagrant/answer_files/2022/Autounattend.xml at main · Orange-Cyberdefense/GOAD · GitHub

Do you know how I can avoid these GUI steps to automate this process so that I don’t have to click anywhere in the GUI?