Don't use insider-preview versions of Hyper-V

This commit is contained in:
James Stringer 2021-12-10 12:27:52 +01:00 committed by GitHub
parent ed0baccf0f
commit 282b8d6271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4301,7 +4301,7 @@ param(
[string]$autologon
)
Modify-AutoUnattend -username "$username" -password "$password" -autologon $autologon -hostname $VMName -UnattendPath $UnattendPath
$MaxAvailableVersion = (Get-VMHostSupportedVersion).Version | Select-Object -Last 1
$MaxAvailableVersion = (Get-VMHostSupportedVersion).Version | Where-Object {$_.Major -lt 254}| Select-Object -Last 1
Convert-WindowsImage -SourcePath $SourcePath -Edition $Edition -VHDFormat $Vhdformat -VHDPath $VhdPath -DiskLayout $DiskLayout -UnattendPath $UnattendPath -GPUName $GPUName -Team_ID $Team_ID -Key $Key -SizeBytes $SizeBytes| Out-Null
New-VM -Name $VMName -MemoryStartupBytes $MemoryAmount -VHDPath $VhdPath -Generation 2 -SwitchName "Default Switch" -Version $MaxAvailableVersion | Out-Null
Set-VM -Name $VMName -ProcessorCount $CPUCores -CheckpointType Disabled -LowMemoryMappedIoSpace 3GB -HighMemoryMappedIoSpace 32GB -GuestControlledCacheTypes $true -AutomaticStopAction ShutDown