How To Create a Windows Server Cloud Image with Cloudbase-Init Baked In
A

Lead Engineer @ Packetware

How To Create a Windows Server Cloud Image with Cloudbase-Init Baked In

This guide assumes you’re starting from a Windows Server ISO (e.g., 2019 or 2022) and want a reusable, automated-ready image.


Prerequisites

You’ll need:


Create a Base VM

Create a new VM in Proxmox (or your hypervisor):

Setting Value
OS Type Microsoft Windows
Version Windows 10/2016+
Disk VirtIO (qcow2, 40 GB recommended)
Network VirtIO (virtio-net or virtio-win)
CD/DVD 1 Windows Server ISO
CD/DVD 2 VirtIO Driver ISO

Boot the VM and install Windows normally.


Install VirtIO Drivers

During Windows setup, when it asks for a disk:

  1. Click Load Driver

  2. Browse to viostor\w10\amd64 on the VirtIO ISO

  3. After installation, also install:

    • Network driversNetKVM\w10\amd64
    • Balloon (optional)
    • QEMU Guest Agentguest-agent\qemu-ga-x64.msi (from the ISO)

Install Cloudbase-Init

  1. Copy the Cloudbase-Init MSI into the VM.
  2. Run the installer (you can do this via GUI or PowerShell):
msiexec /i CloudbaseInitSetup_x64.msi

During installation:

  • Set Service to run as LocalSystem
  • Enable Run service as LocalSystem
  • Select Check metadata services automatically
  • Choose No when asked to run sysprep at the end (you’ll do it manually later)

Configure Cloudbase-Init

Edit the config file: C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf

You can use Notepad or PowerShell:

notepad "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf"

Example minimal configuration:

[DEFAULT]
username=Admin
groups=Administrators
first_logon_behaviour=no
metadata_services=ec2,nocloud,openstack
plugins=cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,cloudbaseinit.plugins.common.networkconfig.NetworkConfigPlugin,cloudbaseinit.plugins.common.userdataplugin.UserDataPlugin
log_dir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\

Optional tweaks:

  • allow_reboot=True (if you want Cloudbase-Init to reboot after first setup)
  • config_drive_raw_hhd=True if using a raw ISO or floppy for metadata (common in Proxmox)

(Optional) Test User-Data Handling

You can test that Cloudbase-Init runs user data by placing a file at:

C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\001-test.ps1

Example content:

Write-Host "Cloudbase-Init is running" | Out-File C:\test.log

When the image boots as a new instance later, that log should appear.


Prepare for Image Generalization

Before converting to an image, clean it up:

Run these PowerShell commands:

# Clear temp and event logs
Remove-Item -Recurse -Force C:\Windows\Temp\*
wevtutil el | ForEach-Object { wevtutil cl $_ }

# Make sure Cloudbase-Init service is automatic
Set-Service -Name cloudbase-init -StartupType Automatic

# Optional: enable RDP
Set-ItemProperty "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name fDenyTSConnections -Value 0

Sysprep the Image

This step resets the SID and prepares for cloning.

Run in PowerShell (as Administrator):

C:\Windows\System32\Sysprep\Sysprep.exe /generalize /oobe /shutdown

Wait for the VM to power off.


Convert to a Cloud Template

Back in Proxmox:

  1. Detach the Windows ISO and VirtIO ISO.
  2. Right-click the VM → Convert to Template (or manually create a QCOW2 image with qemu-img convert).

If exporting manually:

qemu-img convert -O qcow2 windows-server-cloudbase.qcow2 windows-server-cloudbase-final.qcow2

Upload that to your Proxmox or OpenStack image library.


Launch Instances

When you launch a new VM using this image:

  • Cloudbase-Init runs automatically on first boot.
  • It reads metadata / user-data from your cloud (e.g. NoCloud ISO, ConfigDrive, or EC2-style metadata service).
  • It configures hostname, networking, and runs your scripts.

Example NoCloud metadata (for testing):

/seed/nocloud/meta-data
instance-id: test-instance
local-hostname: test-win
/seed/nocloud/user-data
<powershell>
Write-Host "Hello from user-data" | Out-File C:\userdata.txt
</powershell>

Then attach /seed as an ISO to the VM before booting.


Verify

After the instance boots:

  • Check C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\cloudbase-init.log
  • Confirm hostname / network settings
  • Check for files your user-data created (e.g. C:\userdata.txt)