PowerCli enable Secure Boot

Hi All

I’m creating a script and am stuck at finding the correct solution for enabling Secure Boot (basically so the box is ticked post command)

I’ve managed to set the Firmware to EFI but can’t enable the Secure Boot (EFI Boot Only)

I’ve tried the below to no avail:

 

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$bootOptions = New-Object Vmware.Vim.VirtualMachineBootOptions

$bootOptions.vm.ExtensionData.Config.EfiSecureBootEnabled = $true

$spec.BootOptions = $bootOptions

 

Version: VMware vSphere PowerCLI 6.0 Release 2 build 3056836

 

Any help would be much appreciated

Thank you

 

VMWare docs for this ,

https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.security.doc/GUID-898217D4-689D-4EB5-866C-888353FE241C.html

Hi - this doesn’t explain how to configure in PowerCLI format, it only sets the Firmware to EFI

My search hit this result which is an example in VMWare GitHub repo.
https://github.com/vmware/PowerCLI-Example-Scripts/blob/master/Scripts/SecureBoot.ps1