Merge pull request #11756 from sw-fastec/hyper-v-secure-boot-template

Set secure boot template setting for hyper-v
This commit is contained in:
Chris Roberts 2020-07-28 15:05:34 -07:00 committed by GitHub
commit 4f876a59d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}