Managing Lenovo BIOS Settings (Part 4)

by Sep 6, 2018

In the previous tip we showed how you can read and change BIOS settings for Lenovo computers. This was the code to disable WakeOnLan, for example:

#requires -RunAsAdministrator
$currentSetting = Get-WmiObject -Class Lenovo_SetBiosSetting -Namespace root\wmi $currentSetting.SetBiosSetting('WakeOnLAN,Disable').return $SaveSettings = Get-WmiObject -Class Lenovo_SaveBiosSettings -Namespace root\wmi $SaveSettings.SaveBiosSettings().return

If access to BIOS settings is safe-guarded by a password, this is how you would change settings with a BIOS password:

#requires -RunAsAdministrator
$BIOSPassword = "topSecret"
 
$currentSetting = Get-WmiObject -Class Lenovo_SetBiosSetting -Namespace root\wmi
$currentSetting.SetBiosSetting("WakeOnLAN,Disable,$BIOSPassword,ascii,us").return
 
$SaveSettings = Get-WmiObject -Class Lenovo_SaveBiosSettings -Namespace root\wmi
$SaveSettings.SaveBiosSettings("$BIOSPassword,ascii,us").return

Note that the password only takes effect if the BIOS access is safe-guarded by a password. If there is no BIOS password and you submit a password, it will not get checked, and changes take effect.

Twitter This Tip! ReTweet this Tip!