Skip to content
This repository was archived by the owner on Jun 12, 2026. It is now read-only.

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proxmox Windows Image Builder

Build automated Windows Server 2022 VM images on Proxmox VE using Packer and Cloudbase-Init.

This project is designed for home/lab environments.


What This Does

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.


Quick Start

Prerequisites

  1. Proxmox VE installed on your server (IP shown in config: 192.168.1.200)
  2. Packer installed: https://learn.hashicorp.com/tutorials/packer/getting-started-install
  3. QEMU/KVM installed on the build machine
  4. ISO available at /root/iso/2022.iso on the Proxmox node (or update the config path)

Build Commands

# 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-template

The build outputs to build/images/ once complete.


Project Structure

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

Configuration Options

Edit windows-2022.pkr.hcl to customize:

Network Settings

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

VM Settings

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

Storage

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

Build Workflow

The Packer build performs these steps automatically:

  1. Creates VM on specified Proxmox node with configured specs
  2. Attaches Windows ISO and boots installer
  3. Installs Windows Server 2022 with autounattend configuration
  4. Mounts virtIO drivers ISO for storage driver installation
  5. Installs Cloudbase-Init via MSI from custom CD
  6. Enables RDP through PowerShell script
  7. Runs Sysprep to generalize the image
  8. Shuts down and detaches ISO media
  9. Outputs final image to build/images/
  10. Outputs final image to Proxmox

Troubleshooting

Build Fails with "401 Unauthorized"

  • Verify Proxmox API credentials in config file
  • Check token is valid: pvesh get /access/tokens/root@pam/<token-name>

Cannot Connect to Proxmox Node

  • Ensure firewall allows port 8006 (API) and 443 (HTTPS)
  • Verify network connectivity from build machine

No virtio-drivers ISO

  • The build auto-downloads virtio-win drivers if not present
  • Check Proxmox local:iso storage has the downloaded file

Autounattend Issues

  • Verify XML syntax in build/windows/2022/Autounattend.xml
  • Ensure product key field is commented out for home use

License

This project is provided as-is for personal/home lab use.

About

Packer to build windows images from their ISO.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages