You can use PowerShell to view or change the BIOS settings on a Windows computer. Let’s take a look at some examples that allow you to get or change some BIOS settings with PowerShell using WMI (Windows Management Instrumentation) classes on ordinary computers: HP, Lenovo, Dell.
You can view the most important BIOS settings on your computer with the Get-WmiObject command of the Win32_BIOS class :
Get-WmiObject -Class Win32_BIOS | List of formats
This command allows you to view the BIOS version (SMBIOSBIOSVersion, BIOSVersion), the hardware manufacturer, the serial number of the computer, the release date and some other data.
You can only list a few of these BIOS settings:
Get-WmiObject -Class Win32_BIOS | Select-Object Manufacturer, SMBIOSVersion
You can use the Win32_BIOS class to display some BIOS information on any Windows computer. However, some hardware manufacturers offer special WMI classes to access the BIOS directly from the Windows operating system (the hardware manufacturer’s native drivers must be installed on the computer).
Lenovo BIOS settings management via PowerShell
Here’s a list of BIOS settings and their values on Lenovo computers:
Get-WmiObject – class Lenovo_BiosSetting – rootwmi namespace
Display only BIOS parameter names and their current values :
Get-WmiObject – Lenovo_BiosSetting class – rootwmi namespace | select object InstanceName, currentSetting
Make sure a BIOS password is installed on the Lenovo computer:
(gwmi -Class Lenovo_BiosPasswordSettings -Namespace rootwmi).PasswordState
If the command returns 0, the BIOS password is not set.
You can change some BIOS settings on Lenovo computers. For example, activate WOL (Wake-On-LAN) :
$getLenovoBIOS = (gwmi class Lenovo_SetBiosSettings – rootwmi namespace
$getLenovoBIOS.SetBiosSet(WakeOnLAN,Enable)
$SaveLenovoBIOS = (gwmi class Lenovo_SaveBiosSettings – rootwmi namespace)
$SaveLenovoBIOS.SaveBiosSettings()
Changing BIOS settings via PowerShell on Hewlett-Packardcomputers
You can use the following command to obtain the BIOS settings, their values, and options on HP computers:
Get-WmiObject -Namespace root/hp/instrumentedBIOS -Class hp_biosEnumeration | select name, value, possible values -AutoSize
You can change some BIOS settings on HP computers using PowerShell. For example, you may want to disable the startup of the computer from USB devices.
$getHPBios = gwmi -class hp_biossetting interface -name space roothp instrumentedbios
$getHPBios.SetBIOSSet (USB storage boot, disable)
If you need to enter a password to change the BIOS settings, you can use this script:
$HPBIOSPassword = +Passw0rd! 1
$getHPBios = gwmi – class hp_biossetting interface -Name space roothp instrumentedbios
$getHPBios.SetBIOSSetting(‘Network (PXE) Boot’, ‘Disable’,$HPBIOSPassword)
When the last command 0 came back, it was executed successfully. You can use a simple PowerShell manipulator:
ChangeBIOS_State = $bios.setbiossetting(Network (PXE) Boot’, ‘Disable’, $HPBIOSPassword)
$ChangeBIOS_State_Code = $ChangeBIOS_State.
If(($ChangeBIOS_State_Code) -eq 0)
{
write-host OK
}
Else
{
write-host Error – (Return code $ChangeBIOS_State_Code) – Foreground Red
}
If you want to enable the LAN/WLAN connection in your HP notebook BIOS to automatically disconnect the Wi-Fi connection when an Ethernet connection is present, run this command:
$getHPBios.SetBIOSSet (‘LAN/WLAN Switching’, ‘Enable’)
Configuring DELL BIOS settings with PowerShell
You can use the WMI DCIM-BIOSService class or the more modern rootdellomci class (available after installation of the OMCI – Open Manage Client Instrumentation package) to view and manage the BIOS settings on DELL computers.
To view the boot order in the BIOS on Dell computers, run the following command:
Get-WmiObject -NameSpace rootdellomci Dell_BootDeviceSequence | sort boot process | select BootDeviceName, BootOrder
.
For example, B. Activate Wake on LAN in the BIOS :
(Get-WmiObject DCIM-BIOSService – namespace rootdcimsysman).SetBIOSAttributes($null,$null,Wake-On-LAN,4)
Dell has also released a separate PowerShell module, DellBIOSProvider, which is installed with the driver, or you can install it manually with this command:
Installation Module – DellBIOS Vendor Name -Force
This module allows you to view the startup procedure on your Dell computer:
Get-childItem DellSmbios: BootSequence
To change a specific BIOS setting, use the Set-Item command. For example, to change the BIOS password:
Set-Item -Path DellsmbiosSecurityAdminPassword -Value BadDellPa$$ -Password [protected by email].
Using the methods described above, you can create a PowerShell script to export the current BIOS settings from a reference computer (e.g. to a CSV file). You can then use PowerShell to set the same BIOS settings on all computers in your organization.
Related Tags:
powershell enter bios,dell bios powershell,get-wmiobject bios password,update bios powershell,hp wmi namespace,list of bios settings,change hp bios password powershell,set bios password powershell lenovo,hp wmi classes,powershell lenovo bios setting,powershell check if uefi or bios,dell change bios settings from windows,powershell uefi mode,hp set bios password script,hp bios update wmi,hp cmi technical whitepaper,invalid namespace roothpinstrumentedbios,hp cmi whitepaper,hp bios configuration utility remotely,wmic get bios version remotely,hp check bios version powershell,powershell get bios mode uefi,powershell bios install date,how to get bios info from windows,wmi get bios setting,powershell script to change bios settings,powershell lenovo bios settings,powershell change bios settings dell,change bios settings remotely,powershell check if bios password is set,powershell get bios mode,wmic bios powershell