only set EFI secure boot for gen 2 machines in hyperv provider
This commit is contained in:
parent
8b8f2b26a6
commit
fd557592d4
|
@ -136,11 +136,14 @@ $vm | Set-VM @more_vm_params -Passthru
|
||||||
# Add drives to the virtual machine
|
# Add drives to the virtual machine
|
||||||
$controllers = Select-Xml -xml $vmconfig -xpath "//*[starts-with(name(.),'controller')]"
|
$controllers = Select-Xml -xml $vmconfig -xpath "//*[starts-with(name(.),'controller')]"
|
||||||
|
|
||||||
# Set EFI secure boot
|
# Only set EFI secure boot for Gen 2 machines, not gen 1
|
||||||
if ($secure_boot_enabled -eq "True") {
|
if ($generation -ne 1) {
|
||||||
Set-VMFirmware -VM $vm -EnableSecureBoot On
|
# Set EFI secure boot
|
||||||
} else {
|
if ($secure_boot_enabled -eq "True") {
|
||||||
Set-VMFirmware -VM $vm -EnableSecureBoot Off
|
Set-VMFirmware -VM $vm -EnableSecureBoot On
|
||||||
|
} else {
|
||||||
|
Set-VMFirmware -VM $vm -EnableSecureBoot Off
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# A regular expression pattern to pull the number from controllers
|
# A regular expression pattern to pull the number from controllers
|
||||||
|
|
Loading…
Reference in New Issue