Build automated Windows Server 2022 VM images on Proxmox VE using Packer and Cloudbase-Init.
This project is designed for home/lab environments.
Creates a ready-to-use Windows Server 2022 template with:
- Windows Server 2022 installed
- Cloudbase-Init configured (for automated sysprep/generalize)
- RDP enabled by default
- VirtIO drivers pre-configured
The resulting image can be converted to a Proxmox template for reuse across multiple builds.
- Proxmox VE installed on your server (IP shown in config:
192.168.1.200) - Packer installed: https://learn.hashicorp.com/tutorials/packer/getting-started-install
- QEMU/KVM installed on the build machine
- ISO available at
/root/iso/2022.isoon the Proxmox node (or update the config path)
# Install dependencies first
chmod +x requirements.sh
./requirements.sh
# Build Windows Server 2022 image
make proxmox-images TARGET=windows-2022.pkr.hcl IMAGE_NAME=win2022-cloudinit-templateThe build outputs to build/images/ once complete.
packervms/
├── windows-2022.pkr.hcl # Packer configuration (main file)
├── requirements.sh # Dependency checks (packer, qemu)
├── Makefile # Build targets
├── build/
│ ├── images/ # Output location for built VM images
│ └── windows/ # Windows-specific assets:
│ ├── 2022/Autounattend.xml # Autounattend configuration
│ ├── scripts/winrm.ps1 # RDP enablement script
│ └── cloud_init/ # Cloudbase-Init setup files
└── README.md # This file
Edit windows-2022.pkr.hcl to customize:
| Setting | Default | Notes |
|---|---|---|
proxmox_url |
https://192.168.1.200:8006/api2/json |
Change to your Proxmox API endpoint |
username |
root@pam!builder |
Proxmox API user for builds |
node |
pve-0 |
Target Proxmox node name |
| Setting | Default | Notes |
|---|---|---|
vm_id |
9011 |
VM ID (change if already in use) |
vm_name |
win2022-cloudinit-template |
Customizable name |
cores |
8 |
CPU cores |
memory |
8192 |
Memory in MB |
| Setting | Default | Notes |
|---|---|---|
disk_size |
32G |
Initial disk size |
storage_pool |
local-lvm |
Proxmox storage pool |
iso_file |
local:iso/2022.iso |
Windows Server 2022 ISO path |
The Packer build performs these steps automatically:
- Creates VM on specified Proxmox node with configured specs
- Attaches Windows ISO and boots installer
- Installs Windows Server 2022 with autounattend configuration
- Mounts virtIO drivers ISO for storage driver installation
- Installs Cloudbase-Init via MSI from custom CD
- Enables RDP through PowerShell script
- Runs Sysprep to generalize the image
- Shuts down and detaches ISO media
- Outputs final image to
build/images/ - Outputs final image to Proxmox
- Verify Proxmox API credentials in config file
- Check token is valid:
pvesh get /access/tokens/root@pam/<token-name>
- Ensure firewall allows port 8006 (API) and 443 (HTTPS)
- Verify network connectivity from build machine
- The build auto-downloads virtio-win drivers if not present
- Check Proxmox
local:isostorage has the downloaded file
- Verify XML syntax in
build/windows/2022/Autounattend.xml - Ensure product key field is commented out for home use
This project is provided as-is for personal/home lab use.