
Lenovo BIOS Settings and PowerShell
Automation with the Lenovo BIOS PowerShell classes.
1 min read
Contents
Starting with the T/W/X/L x30 series, Lenovo provides WMI classes to modify BIOS/UEFI settings directly from the operating system. The classes are located in the namespace “root\wmi”.
Read BIOS settings
To read a list of all BIOS settings including their current values, the WMI class “Lenovo_BiosSettings” is used. For better readability, the output is slightly modified and “,” is replaced by “=”.
Get-WmiObject -class Lenovo_BiosSetting -namespace root\wmi | ForEach-Object {if ($_.CurrentSetting -ne "") {Write-Host $_.CurrentSetting.replace(","," = ")}}
Set BIOS settings
Two steps are necessary to set or modify BIOS settings. In the first step, a setting is changed via the class “Lenovo_SetBiosSettings”…
$Bios = Get-WmiObject -class Lenovo_SetBiosSetting -namespace root\wmi
$Bios.SetBiosSetting("WakeOnLAN,Enable")
… and in the second step it is saved with “Lenovo_SaveBiosSettings”.
$Bios = Get-WmiObject -class Lenovo_SaveBiosSettings -namespace root\wmi
$Bios.SaveBiosSettings()
Exceptions
A handful of security settings can’t be modified via the WMI classes. For example, the “Secure Rollback Prevention”.
Sources
- Lenovo Support: Lenovo BIOS Setup using Windows Management Instrumentation
- ThinkPad-Forum: BIOS settings via WMI or PowerShell