%WINDIR%\System32\Sysprep\sysprep.exe /generalize /shutdown /oobe /mode:vm
You can use Microsoft DVD images and sysprep
to automate the installation, setup, and software provisioning of Windows virtual machines.
Microsoft does not provide disk images for download, but you can create a disk image using a Windows DVD. This disk image can then be used to create virtual machines.
In the OpenShift Virtualization web console, click Storage → PersistentVolumeClaims → Create PersistentVolumeClaim With Data upload form.
Select the intended project.
Set the Persistent Volume Claim Name.
Upload the VM disk image from the Windows DVD. The image is now available as a boot source to create a new Windows VM.
You can use a disk image to install Windows on your virtual machine.
You must create a disk image using a Windows DVD.
You must create an autounattend.xml
answer file. See the Microsoft documentation for details.
In the OpenShift Container Platform console, click Virtualization → Catalog from the side menu.
Select a Windows template and click Customize VirtualMachine.
Select Upload (Upload a new file to a PVC) from the Disk source list and browse to the DVD image.
Click Review and create VirtualMachine.
Clear Clone available operating system source to this Virtual Machine.
Clear Start this VirtualMachine after creation.
On the Sysprep section of the Scripts tab, click Edit.
Browse to the autounattend.xml
answer file and click Save.
Click Create VirtualMachine.
On the YAML tab, replace running:false
with runStrategy: RerunOnFailure
and click Save.
The VM will start with the sysprep
disk containing the autounattend.xml
answer file.
Generalizing an image allows that image to remove all system-specific configuration data when the image is deployed on a virtual machine (VM).
Before generalizing the VM, you must ensure the sysprep
tool cannot detect an answer file after the unattended Windows installation.
In the OpenShift Container Platform console, click Virtualization → VirtualMachines.
Select a Windows VM to open the VirtualMachine details page.
Click the Disks tab.
Click the Options menu for the sysprep
disk and select Detach.
Click Detach.
Rename C:\Windows\Panther\unattend.xml
to avoid detection by the sysprep
tool.
Start the sysprep
program by running the following command:
%WINDIR%\System32\Sysprep\sysprep.exe /generalize /shutdown /oobe /mode:vm
After the sysprep
tool completes, the Windows VM shuts down. The disk image of the VM is now available to use as an installation image for Windows VMs.
You can now specialize the VM.
Specializing a virtual machine (VM) configures the computer-specific information from a generalized Windows image onto the VM.
You must have a generalized Windows disk image.
You must create an unattend.xml
answer file. See the Microsoft documentation for details.
In the OpenShift Container Platform console, click Virtualization → Catalog.
Select a Windows template and click Customize VirtualMachine.
Select PVC (clone PVC) from the Disk source list.
Specify the Persistent Volume Claim project and Persistent Volume Claim name of the generalized Windows image.
Click Review and create VirtualMachine.
Click the Scripts tab.
In the Sysprep section, click Edit, browse to the unattend.xml
answer file, and click Save.
Click Create VirtualMachine.
During the initial boot, Windows uses the unattend.xml
answer file to specialize the VM. The VM is now ready to use.