From e3223b67ff704bd56c2f23f9687955177fac0686 Mon Sep 17 00:00:00 2001 From: sophia Date: Fri, 7 Aug 2020 17:21:49 -0500 Subject: [PATCH] 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 --- .../hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 b/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 index f893a146a..e2333f3f7 100644 --- a/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +++ b/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 @@ -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 }