Merge pull request #6373 from caleblloyd/patch-1

Hyper-V: select boot device by VM generation
This commit is contained in:
Mitchell Hashimoto 2015-11-18 14:16:54 -08:00
commit d89bd56d27
1 changed files with 18 additions and 8 deletions

View File

@ -81,14 +81,24 @@ if (!$switchname) {
$switchname = (Select-Xml -xml $vmconfig -XPath "//AltSwitchName").node."#text" $switchname = (Select-Xml -xml $vmconfig -XPath "//AltSwitchName").node."#text"
} }
# Determine boot device if ($generation -eq 1) {
Switch ((Select-Xml -xml $vmconfig -XPath "//boot").node.device0."#text") { # Determine boot device
"Floppy" { $bootdevice = "floppy" } Switch ((Select-Xml -xml $vmconfig -XPath "//boot").node.device0."#text") {
"HardDrive" { $bootdevice = "IDE" } "Floppy" { $bootdevice = "Floppy" }
"Optical" { $bootdevice = "CD" } "HardDrive" { $bootdevice = "IDE" }
"Network" { $bootdevice = "LegacyNetworkAdapter" } "Optical" { $bootdevice = "CD" }
"Default" { $bootdevice = "IDE" } "Network" { $bootdevice = "LegacyNetworkAdapter" }
} #switch "Default" { $bootdevice = "IDE" }
} #switch
} else {
# Determine boot device
Switch ((Select-Xml -xml $vmconfig -XPath "//boot").node.device0."#text") {
"HardDrive" { $bootdevice = "VHD" }
"Optical" { $bootdevice = "CD" }
"Network" { $bootdevice = "NetworkAdapter" }
"Default" { $bootdevice = "VHD" }
} #switch
}
# Determine secure boot options # Determine secure boot options
$secure_boot_enabled = (Select-Xml -xml $vmconfig -XPath "//secure_boot_enabled").Node."#text" $secure_boot_enabled = (Select-Xml -xml $vmconfig -XPath "//secure_boot_enabled").Node."#text"