OK here is a patch I have used it for Windows 2012R2 and Windows 2016 I m now trying 2019
IT creates windows only functions in the Cloudinit.pm Linux nocloud and configdrive2 still works
Make sure in your template you set the option to a windows one and then this comes into play
Password kind of works but only plain text eg you need to edit the cipassword:
/etc/pve/qemu-server/xxx.conf
To get arouund this I simplke enable winrm and use some ansible provsioing to do all I want
Backup the
/usr/share/perl5/PVE/QemuServer/Cloudinit.pm
cp /usr/share/perl5/PVE/QemuServer/Cloudinit.pm /root/Cloudinit.pm.org
upload the cloudinit.patch ( I had to add .txt to get this web upload to work
in the directory you uploaded it
patch /usr/share/perl5/PVE/QemuServer/Cloudinit.pm < cloudinit.patch
systemctl restart pvedaemon
The reason dns was not working is the orgianal was using dns_nameservers needs to be dns-nameservers
On your windows image that you are creating start I up I assume you have added Vioscii NetKVM and other drivers you need you will at least need
Virtio Serial
In the Proxmox hardware for that image add a serial port 0 ( make sure you slect one when you install cloudbase-init )
start your image install Cloud base init
cd \
C:\powershell
C:\Set-ExecutionPolicy Unrestricted
C:\Invoke-WebRequest -UseBasicParsing
https://www.cloudbase.it/downloads/CloudbaseInitSetup_Stable_x64.msi -OutFile cloudbaseinit.msi
Wait for the download
.\cloudbaseinit.msi
del .\cloudbaseinit.msi
select the serial port
Don't do system prep or shutdown
Now edit the cloudbaseinit config there are two
cloudbase-init
add meta data service if missing
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService
add the plugins you need
for mine i have
plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin
you may also what set password and create user
cloudbaseinit.plugins.windows.createuser.CreateUserPlugin
cloudbaseinit.plugins.windows.setuserpassword.SetUserPasswordPlugin
cloudbase-init-unattend
edit meta data services
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService
nothing to do on the plugins here
Now system prep the image
cd C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf
C:\Windows\System32\sysprep\sysprep.exe /generalize /oobe /unattend:Unattend.xml
now it should work when you start the image
If you want to make changes to that config with that same image first
Remove KEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cloudbase Solutions\Cloudbase-Init
that will allow cloudinit to rerun
but if you want the image to be fresh
Remove KEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cloudbase Solutions\Cloudbase-Init
and run the sysprep again