So, I made a quick edit on the script that I used in this post to use Differencing Disks.
Just replace…
Write-Progress -Activity "Creating Virtual Machines" -CurrentOperation "Creating $NewVM" -Status "Copy O/S Disk" -PercentComplete ( ( $i / $iCount ) * 100 ) $VhdPath = Join-Path -Path $( ( Get-VMHost ).VirtualHardDiskPath ) -ChildPath "$( $NewVM )_C.vhdx" Start-BitsTransfer -Source $TemplateVHD -Destination $VhdPath -Description "Copying Template Hard Drive" Write-Progress -Activity "Creating Virtual Machines" -CurrentOperation "Creating $NewVM" -Status "Add O/S Disk" -PercentComplete ( ( $i / $iCount ) * 100 ) $VM | Add-VMHardDiskDrive -Path $VhdPath
with…
Write-Progress -Activity "Creating Virtual Machines" -CurrentOperation "Creating $NewVM" -Status "Create O/S Disk (Differencing)" -PercentComplete ( ( $i / $iCount ) * 100 ) $VhdPath = Join-Path -Path $( ( Get-VMHost ).VirtualHardDiskPath ) -ChildPath "$( $NewVM )_C.vhdx" New-VHD -ParentPath $TemplateVhd -Path $VhdPath -Differencing | Out-Null Write-Progress -Activity "Creating Virtual Machines" -CurrentOperation "Creating $NewVM" -Status "Add O/S Disk" -PercentComplete ( ( $i / $iCount ) * 100 ) $VM | Add-VMHardDiskDrive -Path $VhdPath
Differencing disks use less disk space, but you sacrifice disk performance. Since I’m working with a local flash disk, I decided that this was worth the risk.