From fd557592d4f6fb96055837b6ce6fb132f8a84d91 Mon Sep 17 00:00:00 2001 From: ssugar Date: Mon, 30 Mar 2015 20:00:16 +0700 Subject: [PATCH] only set EFI secure boot for gen 2 machines in hyperv provider --- plugins/providers/hyperv/scripts/import_vm.ps1 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/providers/hyperv/scripts/import_vm.ps1 b/plugins/providers/hyperv/scripts/import_vm.ps1 index 791daecd7..3e8664eb2 100644 --- a/plugins/providers/hyperv/scripts/import_vm.ps1 +++ b/plugins/providers/hyperv/scripts/import_vm.ps1 @@ -136,11 +136,14 @@ $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 +# Only set EFI secure boot for Gen 2 machines, not gen 1 +if ($generation -ne 1) { + # 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