Windows template preparation

cyruspy

Renowned Member
Jul 2, 2013
199
29
93
Unlike Linux Cloud Images, there are no Windows Server VM images provided by Microsoft, so I created pve-build-windows-template to generate PVE friendly VM templates. A non-interactive run turns a Windows Server ISO into a sysprepped, Cloudbase-Init-capable PVE template.

How to use it

Bash:
./pve-build-windows-template \
    --iso dstore01:iso/win2022.iso \
    --edition both --sku standard \
    --storage dstore01 --start-id 9020

What it does

Produces two templates — Server Core and Desktop Experience — at consecutive VMIDs. Per run it:
  1. injects virtio storage/NIC drivers into WinPE so Setup sees the disk
  2. installs the virtio set, QEMU guest agent, SPICE agent and Cloudbase-Init
  3. enables RDP with its firewall rule
  4. sets the Windows Update policy
  5. runs sysprep /generalize /oobe /shutdown
  6. verifies offline
  7. attaches the cloud-init drive and seals.

Environment was tested with: Server 2019, 2022, 2025. UEFI/GPT, q35, OVMF, TPM 2.0, Secure Boot with pre-enrolled keys, virtio-scsi-single.

Link: https://github.com/ciroiriarte/pve-tools#pve-build-windows-template