From 282b8d627127530740ab35cd4e9794ec9215dde2 Mon Sep 17 00:00:00 2001 From: James Stringer <38541878+jamesstringerparsec@users.noreply.github.com> Date: Fri, 10 Dec 2021 12:27:52 +0100 Subject: [PATCH] Don't use insider-preview versions of Hyper-V --- CopyFilesToVM.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CopyFilesToVM.ps1 b/CopyFilesToVM.ps1 index 78b65c5..f5d6620 100644 --- a/CopyFilesToVM.ps1 +++ b/CopyFilesToVM.ps1 @@ -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