Search code examples
windowsqemupackerunattended-processingunattend-file

Is it possible to apply unattend.xml on custom prepared image when deploy new PC?


I've created custom Windows_10_PRO_1909_x64 image with hashicorp packer (with QEMU). To build it I used unattend.xml file. Steps to prepare were:

  1. Absolutely unattended installation of Windows
  2. Installation of big amount of software
  3. Converting VM (it was build with QEMU) to raw .img file

Now I want to deploy this image to new PC. I'm using bootable USB stick with embedded Linux (also custom) which can grab this .img file from local storage and write to /dev/sda Everything works fine in this process.

Main problem is - after writing .img to /dev/sda I'm changing ComputerName in unatted.xml file (on mounted /dev/sda), but after first time boot, Windows ignores this file, and PC name is the same as it was before changing. When I checked unattend file, it has correct PC name, which I changed while was on bootable linux, before Windows first run.

Maybe somebody have an idea - how I can change PC name, each time I deploy new PC? But it should be without user interaction. It could be any file modification on bootable linux, or maybe there is a way to do it automatically on first Windows boot?


Solution

  • Found solution.

    Need to run sysprep afer Windows install with sysprep-unattend.xml file to clean system. After it Windows will catch this file on first boot. So it's possible to change PC name in this file before boot.