At least one sysprepped VHDX with an installed but not configured operating system is required as base the virtual machines. This process can be automated by invoking buildBaseImage.ps1.
The script will
- Build a bootable VHDX with the ISOs OS preinstalled (but not yet configured).
- (Optionally) Get the latest cumulative update and apply it to the virtual drive.
- Enable Net Framework 3.5 (since it's still required by many apps and products).
- Shrink the virtual hard disk to its absolute minimum size using sdelete and Optimize-VHD.
- Place the resulting VHDX in the same directory as the provided ISO. The file may then be moved to .\sources\Images.
Example without installing the latest cumulative update:
.\ps\buildBaseImage.ps1 -isoPath 'c:\hyper-v\psvmdeployment\sources\Images\server_2019.iso' -SKU 'Standard (Desktop Experience)'
Example including installing the latest cumulative update:
.\ps\buildBaseImage.ps1 -isoPath 'c:\hyper-v\psvmdeployment\sources\Images\server_2019.iso' -SKU 'Standard (Desktop Experience)' -InstallLatestCU -Product 'Windows Server' -Version 2019