Permalink
Browse files

Fix for: [hyperv]: VM import process does not respect Secure Boot opt…

…ion from image #5209
  • Loading branch information...
tomassrnka committed Jan 17, 2015
1 parent a2322c4 commit 21e2f33fb0e6ed9acd23f279b2806d0d9761e609
Showing with 10 additions and 0 deletions.
  1. +10 −0 plugins/providers/hyperv/scripts/import_vm.ps1
@@ -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"

0 comments on commit 21e2f33

Please sign in to comment.