02-10-2023 03:19 AM - edited 02-10-2023 06:58 PM
Hey folks,
Recently @BrightRodger asked is it possible to manage BIOS via JC command - I think it's a pretty cool idea. After a quick research it turns out the BIOS for the big 3 (Lenovo, HP, Dell) all have PowerShell manageability!
Inspired from the articles:
Lenovo BIOS Settings Management
Working with the Dell Command | PowerShell Provider
I had a chance to test in JC cmd on my Lenovo box, let's dive into it.
As usual, create a new JumpCloud command -> Select Windows and PowerShell. Now pick a setting and put it in the first line - I'm using "WakeOnLANDock" as an example:
<#
Disclaimer: Modifying the BIOS settings can be a complex and potentially dangerous process. Improper changes to the BIOS settings can cause serious harm to your computer, including system instability, hardware damage, and loss of data. If you are not familiar with the process or not confident in your ability to make the necessary changes, it is recommended that you seek the assistance of a qualified professional. By proceeding with changes to the BIOS settings, you assume full responsibility for any consequences that may result, and relieve the publisher and authors of this information of any liability.
#>
# Pick a setting to set
$settingName = "WakeOnLANDock"
# Getting the current setting
$currentSettings = Get-WmiObject -Namespace root\wmi -Class Lenovo_BiosSetting | Select-Object CurrentSetting
$currentValue = ($currentSettings | Where-Object {$_.CurrentSetting -Like "*$settingName*"}).CurrentSetting.replace(',','=')
$settingValues = (gwmi –class Lenovo_GetBiosSelections –namespace root\wmi).GetBiosSelections($settingname).selections
Write-Host "Settings available for $settingname : $settingvalues"
Write-Host "The current setting is $currentValue"
# Setting the new value
$newValue = $settingvalues.Split(',')[1] # Pick and choose a value, in this case is "disable"
Write-Host "$settingname is going to be set as $newvalue.."
$setSettings = Get-WmiObject -Namespace root\wmi -Class Lenovo_SetBiosSetting
$setSettings.SetBiosSetting("$settingName,$newValue")
# Connect to the Lenovo_SetBiosSetting WMI class
Write-Host "Saving the bios setting..."
$SaveSettings = Get-WmiObject -Namespace root\wmi -Class Lenovo_SaveBiosSettings
$SaveSettings.SaveBiosSettings()
Save it and give it a run!
You can find the full list of the settings here from Lenovo. A few interesting settings:
BootMode
BootOrderLock
FingerprintSecurityMode
SecureBoot
P.S. I don't have Dell & HP boxes to test but they work similarly - especially HP, it uses the almost identical WMI classes. They should be able to work well with JC cmd like Lenovo.
New to the site? Take a look at these additional resources:
Ready to join us? You can register here.