Set secure boot template setting for hyperv

This commit is contained in:
Stephan Wild 2020-07-04 14:11:33 +02:00
parent 6ee180a023
commit 4ff1ff5bc0

View File

@ -223,6 +223,7 @@ function New-VagrantVMXML {
# Determine if secure boot is enabled
$SecureBoot = (Select-Xml -XML $VMConfig -XPath "//secure_boot_enabled").Node."#text"
$SecureBootTemplate = (Select-Xml -XML $VMConfig -XPath "//secure_boot_template").Node."#text"
$NewVMConfig = @{
Name = $VMName;
@ -242,6 +243,9 @@ function New-VagrantVMXML {
if($Gen -gt 1) {
if($SecureBoot -eq "True") {
Hyper-V\Set-VMFirmware -VM $VM -EnableSecureBoot On
if(![System.String]::IsNullOrEmpty($SecureBootTemplate)) {
Hyper-V\Set-VMFirmware -VM $VM -SecureBootTemplate $SecureBootTemplate
}
} else {
Hyper-V\Set-VMFirmware -VM $VM -EnableSecureBoot Off
}