Introduction
This article shows an example of how you can create a VHI image template from an existing Windows 10 VM inside Virtuozzo Hybrid Infrastructure.
The example given is Windows 10 but you amy attempt it on other Windows OSes.
The basic idea is you create a reference Windows VM on VHI (upload a windows iso and install it and create a Windows VM) and then you install Cloudbase-Init on to it and then customise it with your software and then use sysprep to generalise it and then finally you can use the boot volume from the reference Windows VM to create a VHI Image template. From the Template you can create any number of Windows Virtual Machines on VHI.
Note this is a basic sysprep example. Kindly refer to Microsoft documentation for more complex scenarios.
Steps
To prepare a Windows Boot Volume to create VHI Image Templates, do the following:
Create A Windows 10 reference VM on Virtuozzo Hybrid Infrastructure
-
Obtain a distribution image of Microsoft Windows 10 v1909 or newer and upload it to Virtuozzo Hybrid Infrastructure. For details, see the Virtuozzo Hybrid Infrastructure Administrator’s Guide.
-
Create a reference Windows VM based on the uploaded Windows iso image. For details, see the Virtuozzo Hybrid Infrastructure Administrator’s Guide.
-
Start the reference Windows VM and open its console from the VM details pane or the context menu. Perform the next steps from inside the VM.
-
Complete Windows installation.
-
Install the updates.
Preparing the Reference Windows 10 VM
-
Install Cloudbase-Init in the VM. Perform steps 1 to 4 from the Virtuozzo Hybrid Infrastructure Administrator’s Guide. Do not stop the VM at this point.
Important Note: When installing Cloudbase-Init software make sure the user setting in the Cloudbase-Init installation wizard is actually the currently logged in user in the Windows VM. If you want to know which user is logged in, go to Command Prompt and execute command: whoami. -
Optimize the system for better performance. For example, with this optimization tool.
-
Install Virtuozzo guest tools. See the Virtuozzo Hybrid Infrastructure Administrator’s Guide.
-
Optionally, if you need to use random desktops, install FSLogix Agent and configure Profile Container as described in the official documentation.
-
Install user applications: messengers, office programs, and such.
-
Create an answer file for the Sysprep tool. One of the ways to do it is provided further. Perform these steps on a machine with the same version of Windows as the reference VM. For example, if you are preparing a Windows 10 v1909 image, perform these steps on machine running Windows 10 v1909 as well.
-
Mount the distribution image of Microsoft Windows 10 and copy its contents to a writable folder, e.g., on disk C:.
-
Download the Windows Assessment and Deployment Kit. Install only the Deployment Tools from it.
-
Launch the Windows System Image Manager installed with the Deployment Tools.
-
ClickFile>New Answer File. You will be asked to provide a Windows image. Choose the
sources\install.wimfile from the folder with the distribution image contents.
-
If you do not have a catalog file, create one as offered.
-
Once a new answer file is loaded, configure its keys:
Set
amd64_Microsoft-Windows-International-Core-WinPE:
Set
amd64_Microsoft-Windows-Setup>UserData>AcceptEUDAtoTrue.Set
amd64_Microsoft-Windows-Shell-Setup>CopyPofiletoTrue.Set
amd64_Microsoft-Windows-Shell-Setup>OOBE:
Create a new account in
amd64_Microsoft-Windows-Shell-Setup>UserAccounts>LocalAccounts:
And set a password for it:

-
Save the answer file. It may resemble this sample.
-
Copy the answer file to the reference VM.
-
-
Prepare Windows with Sysprep, using the answer file. For more details, see its documentation. Inside the reference VM, from the console, run:
> C:\Windows\System32\Sysprep\sysprep.exe /oobe /generalize /unattend:C:\answerfile.xml
Where
C:\answerfile.xmlis the path to your answer file. -
After the process completes, the reference VM will shut down.
-
Now you can create the image that you will create templates from. Click the reference VM to open its details. Click the bootable volume to open its details. In the volume details, Click Create image. The volume will be converted to an image and show up in Virtual machines>Images. Follow guide from here: Creating Templates
You can now create any number of VMs from the Image Template that was created from step 1-9.