Merge pull request #5210 from tomassrnka/5209-vm-import-secure-boot
providers/hyperv: import respects box's original Secure Boot setting
This commit is contained in:
commit
47ea548026
|
@ -90,6 +90,9 @@ Switch ((Select-Xml -xml $vmconfig -XPath "//boot").node.device0."#text") {
|
|||
"Default" { $bootdevice = "IDE" }
|
||||
} #switch
|
||||
|
||||
# Determine secure boot options
|
||||
$secure_boot_enabled = (Select-Xml -xml $vmconfig -XPath "//secure_boot_enabled").Node."#text"
|
||||
|
||||
# Define a hash map of parameter values for New-VM
|
||||
|
||||
$vm_params = @{
|
||||
|
@ -133,6 +136,13 @@ $vm | Set-VM @more_vm_params -Passthru
|
|||
# Add drives to the virtual machine
|
||||
$controllers = Select-Xml -xml $vmconfig -xpath "//*[starts-with(name(.),'controller')]"
|
||||
|
||||
# Set EFI secure boot
|
||||
if ($secure_boot_enabled -eq "True") {
|
||||
Set-VMFirmware -VM $vm -EnableSecureBoot On
|
||||
} else {
|
||||
Set-VMFirmware -VM $vm -EnableSecureBoot Off
|
||||
}
|
||||
|
||||
# A regular expression pattern to pull the number from controllers
|
||||
[regex]$rx="\d"
|
||||
|
||||
|
|
Loading…
Reference in New Issue