Fix for gen1 VM disks being attached on SCSI controller instead of IDE

This commit is contained in:
Ryan McCallum 2023-06-26 15:50:24 -04:00
Родитель 4d575e6f4c
Коммит 7b0fc81279
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -72,7 +72,7 @@ if ($hyperv.Installed -and $hypervTools.Installed -and $hypervPowerShell.Install
$return = Set-DhcpServerv4OptionValue -DnsServer 168.63.129.16 -Router 192.168.0.1 -ErrorAction Stop
# Create the nested guest VM
if (!$gen) {
if (!$gen -or ($gen -eq 1)) {
Log-Info 'Creating Gen1 VM with 4GB memory' | Out-File -FilePath $logFile -Append
$return = New-VM -Name $nestedGuestVmName -MemoryStartupBytes 4GB -NoVHD -BootDevice IDE -Generation 1 -ErrorAction Stop
}
@ -84,9 +84,9 @@ if ($hyperv.Installed -and $hypervTools.Installed -and $hypervPowerShell.Install
$disk = get-disk -ErrorAction Stop | where {$_.FriendlyName -eq 'Msft Virtual Disk'}
$return = $disk | set-disk -IsOffline $true -ErrorAction Stop
if (!$gen) {
if (!$gen -or ($gen -eq 1)) {
Log-Info "Gen1: Adding hard drive to IDE controller" | Out-File -FilePath $logFile -Append
$return = $disk | Add-VMHardDiskDrive -VMName $nestedGuestVmName -ErrorAction Stop
$return = $disk | Add-VMHardDiskDrive -VMName $nestedGuestVmName -ErrorAction Stop
}
else {
Log-Info "Gen$($gen): Adding hard drive to SCSI controller" | Out-File -FilePath $logFile -Append