Merge pull request #11809 from soapy1/fix-secure-boot

Fix if statement to use '-and' syntax
This commit is contained in:
Sophia Castellarin 2020-08-07 17:43:34 -05:00 committed by GitHub
commit 5135bdfc2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -243,9 +243,13 @@ function New-VagrantVMXML {
if($Gen -gt 1) {
if($SecureBoot -eq "True") {
Hyper-V\Set-VMFirmware -VM $VM -EnableSecureBoot On
if(![System.String]::IsNullOrEmpty($SecureBootTemplate) && (Get-Command Hyper-V\Set-VMFirmware).Parameters.Keys.Contains("secureboottemplate")) {
Hyper-V\Set-VMFirmware -VM $VM -SecureBootTemplate $SecureBootTemplate
}
if (
( ![System.String]::IsNullOrEmpty($SecureBootTemplate) )`
-and`
( (Get-Command Hyper-V\Set-VMFirmware).Parameters.Keys.Contains("secureboottemplate") )
) {
Hyper-V\Set-VMFirmware -VM $VM -SecureBootTemplate $SecureBootTemplate
}
} else {
Hyper-V\Set-VMFirmware -VM $VM -EnableSecureBoot Off
}