Fixed SecureBootTemplate not being passed through to PS cmdlet

Added check for SecureBootTemplate parameter for Server 2012 and below
Corrected enableSecureBootString usage
pull/6419/head
Simon Hulme 8 years ago
parent e003b15001
commit 475e79a251

@ -518,8 +518,13 @@ Hyper-V\Set-VMNetworkAdapter -VMName $vmName -MacAddressSpoofing $enableMacSpoof
func SetVirtualMachineSecureBoot(vmName string, enableSecureBoot bool, templateName string) error {
var script = `
param([string]$vmName, $enableSecureBoot)
Hyper-V\Set-VMFirmware -VMName $vmName -EnableSecureBoot $enableSecureBoot
param([string]$vmName, [string]$enableSecureBootString, [string]$templateName)
$cmdletParameterExists = Get-Help SetVMFirmware -Parameter SecureBootTemplate -ErrorAction SilentlyContinue
if ($cmdletParameterExists) {
Hyper-V\Set-VMFirmware -VMName $vmName -EnableSecureBoot $enableSecureBootString -SecureBootTemplate $templateName
} else {
Hyper-V\Set-VMFirmware -VMName $vmName -EnableSecureBoot $enableSecureBootString
}
`
var ps powershell.PowerShellCmd

Loading…
Cancel
Save