Files
ziadarafat 6a024fe75e windows-vm: promptless install ISO via Microsoft's noprompt boot image
UEFI does not use bootfix.bin (that is BIOS-only); cDBoot prompts on its own and
cannot be dismissed without a keyboard device, which Proxmox reserves for
root@pam via -args. So the prompt is removed from the media instead: the ISO
ships efi/microsoft/boot/efisys_noprompt.bin, byte-for-byte the same size as the
El Torito UEFI image, so it overwrites it in place and the boot catalog stays
valid. build-noprompt-iso.sh does it and verifies the result.

Firmware now starts the CD with no keystroke, but OVMF stalls in Start boot
option and never reaches Setup, so the Packer build still does not complete.
2026-11-28 20:58:19 -07:00
..

Throwaway Windows VMs on Proxmox

Goal: a Windows guest for testing things that need Windows (USB devices, firmware tools, drivers) that can be created and driven without touching the console.

The automation hooks

A provisioned VM has everything needed to run it entirely over the network:

Hook What it gives you
qemu-guest-agent qm guest exec <id> -- cmd /c …, qm shutdown, qm guest cmd — no RDP, no console
OpenSSH Server (port 22) ordinary ssh doge@<vm-ip>, far easier to script than WinRM
WinRM (HTTP, Basic) Packer's default communicator; Invoke-Command from PowerShell
Auto-logon clones boot straight to a desktop; no sign-in screen to fight
Sleep and lock disabled automation never races a screensaver or lock screen

Credentials on a provisioned VM: doge / doge123! (thrown away with the VM).

answer/autounattend.xml creates the account and runs provision.ps1 at first logon, which installs all of the above. So an install ends with a usable, remotely-driveable machine and no manual steps after the media prompt.

1. Template + clone (everyday path, ~1 minute)

# once: build the baseline and convert it
qm clone 9000 150 --name win-test --full        # 9000 = template id
qm set   150 --memory 8192 --cores 4
qm set   150 -hostpci0 0000:0c:00.3,pcie=1      # only when the test needs real hardware
qm start 150
qm guest cmd 150 network-get-interfaces        # find its address
ssh doge@<addr>                                 # or: qm guest exec 150 -- cmd /c ver

Template creation: run sysprep /oobe /generalize /shutdown inside Windows, then qm template <id>. Sysprep is optional for single-use test VMs — a clone without it shares the SID, which only matters on a domain.

2. Packer (clean rebuild from ISO)

packer init .
packer build -var proxmox_token="$PROXMOX_PACKER_TOKEN" win11.pkr.hcl

Needs local:iso/win11-eval.iso, local:iso/virtio-win.iso and local:iso/answer.iso (build the last one with build-answer-iso.sh). The token belongs in secretctl, never here: create a packer@pve user with a role carrying VM.Allocate, VM.Config.*, Datastore.AllocateSpace.

The traps (learned the hard way, 2026-11-28)

  1. qm reset does not reload VM config. Only qm stop && qm start applies qm set changes. A reset reproduces the old behaviour exactly.
  2. An invalid autounattend.xml reboots Setup in a loop. Missing the wcm namespace (xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State") makes wcm:action an unbound prefix. Setup rejects the file at the first screen: the purple installer window flashes, the screen goes black, UEFI restarts. build-answer-iso.sh validates the XML before building.
  3. qm sendkey cannot satisfy the media boot prompt. It injects PS/2 events, a q35 VM has only a USB pointer, and the prompt lives ~5 s. It does work at the firmware menu and inside Windows. Packer's boot_command repeats the spacebar over VNC, which is the reliable way:
    boot_command = ["<wait><spacebar><wait><spacebar><wait><spacebar><wait>"]
    
    QEMU key names matter when driving by hand: . is dot, / is slash, \ is backslash, : is shift-semicolon, space is spc.
  4. Pass the whole PCIe controller, not the device. Device passthrough is still enumerated by the host kernel first. Isolated on ziadpve: 0c:00.3 (group 27), 0c:00.4 (28), 07:00.0 (22). 08:00.1/08:00.3 share group 16 with a SATA controller and cannot be passed.

Red herrings

  • A Proxmox logo with a progress bar on a Windows VM's console is Proxmox's own OVMF boot splash, not the Proxmox installer.
  • vfio-pci 0000:0c:00.3: resetting / reset done per boot is normal.
  • ehci: PERIODIC list base register set … is a cosmetic QEMU warning.

Is it stuck or crashed?

printf 'screendump /tmp/f.ppm\n' | qm monitor <id>
pnmtopng /tmp/f.ppm > /tmp/f.png
md5sum /tmp/f.png          # identical over time = static screen

A crash loop shows repeated distinct frames; a waiting installer shows one stable frame. Kill stray screendump loops or they pollute later comparisons.

Files

File Purpose
win11.pkr.hcl Packer build → UEFI + vTPM, virtio disk/NIC, answer ISO, sysprep, template
answer/autounattend.xml Unattended install: disk, account, autologon, first-logon hook
answer/provision.ps1 Installs guest agent, WinRM, OpenSSH, auto-logon; writes C:\provision-done.txt
build-answer-iso.sh Validates the answer file and builds local:iso/answer.iso