Changing BIOS settings with WMI
This is doing my head in. I have literally Googled for two hours and cannot find an answer to simply turn on SecureBoot with Powershell 7
I cannot find the Lenovo WMI class documentation anywhere, but these syntax's look correct.
Get-CimInstance -Namespace root/WMI -ClassName Lenovo_BiosSetting | Where-Object {$_.CurrentSetting -match "SecureBoot"} | select currentsetting
currentsetting
--------------
SecureBoot,Enable
That works fine - setting the setting, however, just errors:
$saveBios = Get-WmiObject -Namespace root\wmi -Class Lenovo_SetBiosSettings
$interface.SetBIOSSetting("SecureBoot","Enable")
InvalidOperation: Method invocation failed because [Deserialized.System.Management.ManagementObject#root\wmi\Lenovo_SetBiosSetting] does not contain a method named 'SetBIOSSetting'.
Any ideas what I'm doing wrong?