PowerShell
BIOS Settings with PowerShell

BIOS Settings with PowerShell

In different cases it is more conveniant to read out the BIOS settings within Windows or even modify them.
Depending on the brand of your machine you can find a complete handbook to achieve that with Powershell.

Here I give you the example for Lenovo and HP – Just examples that may work for your machine or not – check the manual coresponding do your machine!

Lenovo

Tested on Lenovo T14 models.

# List all Settings
gwmi -class Lenovo_BiosSetting -namespace root\wmi | ForEach-Object {if ($_.CurrentSetting -ne "") {Write-Host $_.CurrentSetting.replace(","," = ")}}

# Show a partical value
gwmi -class Lenovo_BiosSetting -namespace root\wmi | Where-Object {$_.CurrentSetting.split(",",[StringSplitOptions]::RemoveEmptyEntries) -eq "MACAddressPassThrough"} | Format-List CurrentSetting 

# Full BIOS Settings as table
gwmi -class Lenovo_BiosSetting -namespace root\wmi  | Out-GridView

# Set a BIOS setting 
# Use the following command as a template to set the value of a setting. 
# This is a two-step process: set and then save. 
# Note: The setting string is case sensitive and should be in the format "<item>,<value>". 
(gwmi -class Lenovo_SetBiosSetting –namespace root\wmi).SetBiosSetting("WakeOnLAN,Disable")
(gwmi -class Lenovo_SaveBiosSettings -namespace root\wmi).SaveBiosSettings() 

# Set a BIOS setting when a supervisor password exists 
# Use the following command as a template to set the value of a setting 
# when a supervisor password exists. 
# This is a two-step process: set and then save. 
# Note: The setting string is case sensitive and should be in the format 
# "<item>,<value>,<password + encoding>". 
(gwmi -class Lenovo_SetBiosSetting –namespace root\wmi).SetBiosSetting("VTdFeature,Enable,yourbiospassword,ascii,us")
(gwmi -class Lenovo_SaveBiosSettings -namespace root\wmi).SaveBiosSettings("yourbiospassword,ascii,us")

# Examples:
(gwmi -class Lenovo_SetBiosSetting -namespace root\wmi).SetBiosSetting("VirtualizationTechnology,Disable,yourbiospassword,ascii,us")
(gwmi -class Lenovo_SaveBiosSettings -namespace root\wmi).SaveBiosSettings("yourbiospassword,ascii,us") 

HP

Tested on HP 840 models.

# Get Settings
Get-WmiObject -Namespace root/hp/InstrumentedBIOS -Class HP_BIOSEnumeration

# Get Settings but in txt file
Get-WmiObject -Namespace root/hp/InstrumentedBIOS -Class HP_BIOSEnumeration | Out-File -FilePath c:\HPBiosSettings\HPBiosSettings.txt 

# Save HP Settings in a variable
$HPBiosSettings = Get-WmiObject -Namespace root/hp/InstrumentedBIOS -Class HP_BIOSSetting 

# Example for changing a value
$Interface.SetBIOSSetting("Reuse Embedded LAN Address","Enable")

# Example
# Put all values in a variable
$SettingList = Get-WmiObject -Namespace root\HP\InstrumentedBIOS -Class HP_BIOSEnumeration  
# Output just the name and value from the variable set before
$SettingList | Select-Object Name,Value
# Output just the name and value for "Reuse Embedded LAN Address"
($SettingList | Where-Object Name -eq "Reuse Embedded LAN Address") | select-object Name,Value 

# Example with BIOS Password
$Password = "<utf-16/>"+"yourbiospassword"
$BIOS = gwmi -class hp_biossettinginterface -Namespace "root\hp\instrumentedbios"
$result = $BIOS.SetBIOSSetting("NumLock on at boot", "Enable", "$Password")

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments