Fix if statement to use '-and' syntax

Docs for powershell:
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_logical_operators?view=powershell-7
This commit is contained in:
sophia 2020-08-07 17:21:49 -05:00
parent 75253b41bb
commit e3223b67ff

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
}