Managing Lenovo BIOS Settings (Part 3)

by Sep 5, 2018

In the previous tip we explained how to manage Lenovo BIOS settings from PowerShell. Typically, there are single settings that need to be managed. Please note that you need Administrator privileges for some of the operations.

Here is code that dumps the names of all available settings. Note that these names are case-sensitive:

$currentSetting = Get-WmiObject -Class Lenovo_BiosSetting -Namespace root\wmi 
$currentSetting.CurrentSetting | 
    Where-Object { $_ } |
    ForEach-Object { $_.Split(',')[0] }

Once you know the name of a setting you’d like to control, this is the code you can use to read the setting:

$Settingname = "WakeOnLAN"

$currentSetting = Get-WmiObject -Class Lenovo_BiosSetting -Namespace root\wmi -Filter "CurrentSetting LIKE '%$SettingName%'"
$currentSetting.CurrentSetting  
 

This is the code that dumps the available values for a given setting:

#requires -RunAsAdministrator

# this is case-sensitive
$Setting = "WakeOnLAN"

$selections = Get-WmiObject -Class Lenovo_GetBiosSelections -Namespace root\wmi
$selections.GetBiosSelections($Setting).Selections.Split(',')
 

And this is how you can change a setting to a new value (i.e., disabling WakeOnLan):

#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
 

Twitter This Tip! ReTweet this Tip!