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:
- A Windows Server ISO (2019 or 2022 evaluation or licensed)
- A Proxmox / KVM host or other hypervisor that can export
.qcow2or.rawimages - A VirtIO driver ISO (for disk & network drivers): 👉 https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/
- The Cloudbase-Init MSI installer: 👉 https://cloudbase.it/cloudbase-init/
- Optional: RDP access to the VM while preparing
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:
Click Load Driver
Browse to
viostor\w10\amd64on the VirtIO ISOAfter installation, also install:
- Network drivers →
NetKVM\w10\amd64 - Balloon (optional)
- QEMU Guest Agent →
guest-agent\qemu-ga-x64.msi(from the ISO)
- Network drivers →
Install Cloudbase-Init
- Copy the Cloudbase-Init MSI into the VM.
- 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=Trueif 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:
- Detach the Windows ISO and VirtIO ISO.
- 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)
