Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / PowerShell / How to View and Change BIOS (UEFI) Settings with PowerShell

September 13, 2023

How to View and Change BIOS (UEFI) Settings with PowerShell

You can use PowerShell to view or change BIOS/UEFI settings on a Windows computer. In this article, we will look at how to use Windows PowerShell to get or change computer BIOS settings on regular computers and on popular brand devices  (HP, Lenovo, Dell, and Toshiba).

Contents:
  • Check BIOS/UEFI Version with PowerShell
  • How to Get or Change BIOS Settings with the Get-BIOS Module
  • List BIOS Settings on Lenovo Device with PowerShell
  • PowerShell: List and Change BIOS Settings on HP Computers
  • Configure DELL BIOS Settings with PowerShell

Check BIOS/UEFI Version with PowerShell

The WMI class Win32_BIOS provides basic information about the computer’s BIOS (UEFI). You can use the Get-WmiObject cmdlet to get BIOS information from WMI (Windows Management Instrumentation).

Get-WmiObject -Class Win32_BIOS

check bios version with powershell

By default, the command returns information about the BIOS version (SMBIOSBIOSVersion), manufacturer, serial number, and computer model.

You must use CIM classes instead of WMI classes in the newest versions of PowerShell Core 7.x. In this case, the previous command should look like this:

Get-CimInstance -Class Win32_BIOS

To view the full list of BIOS parameters that are available in the Win32_BIOS WMI class, use the command:

Get-WmiObject -Class Win32_BIOS | Format-List *

Get-WmiObject Win32_BIOS

You can view only the BIOS settings you are interested in. For example, BIOS version, computer serial number, manufacturer, and release date:

Get-WmiObject -Class Win32_BIOS | Select SMBIOSBIOSVersion, Manufacturer, SerialNumber, ReleaseDate

You can also get BIOS information from a remote computer:

Get-WmiObject -Class Win32_BIOS -ComputerName MUN-WKS41

Computer BIOS information is stored in the Windows registry. You can get BIOS information directly from the registry using PowerShell:

Get-ItemProperty -Path HKLM:\HARDWARE\DESCRIPTION\System\BIOS

get bios version from registry

The Win32_BIOS is a generic class that can be used to get basic BIOS information on any Windows device. However, some hardware vendors provide special WMI classes to access the BIOS directly from the Windows OS (you will need to install the manufacturer’s native drivers.).

How to Get or Change BIOS Settings with the Get-BIOS Module

You can use a separate module of PSGallery called Get-BIOS to get BIOS/UEFI settings for Dell, HP, Lenovo, and Toshiba computers.

Install the module from the PowerShell online gallery (PowerShell modules can be installed offline):

Install-Module GetBIOS

getbios powershell module

To view your computer’s BIOS settings, run the command:

Get-BIOS

list bios (uefi) settings with powershell

With some versions of the BIOS, you can display not only the current value of the BIOS parameter but also its description and the possible values:

Get-BIOS -ShowDescription

There is also a module from the same developer that allows you to change the BIOS settings on Dell, Lenovo, and HP machines.

Install-Module SetBIOS

You need to create a CSV file in the following format to change your device’s BIOS settings: {Setting, Value}.

upload new bios settings with powershell

In order to apply a CSV file containing the BIOS settings, run the following command

Set-BIOS -Path "YourBIOSSettingsFile.csv"

If the BIOS is password protected, add -Password to the option.

List BIOS Settings on Lenovo Device with PowerShell

Current BIOS settings are stored in a separate WMI class on Lenovo computers. You can list the available BIOS options and their values on the Lenovo device:

Get-WmiObject -class Lenovo_BiosSetting -namespace root\wmi | select-object InstanceName, currentsetting

list all Lenovo_BiosSetting using powershell

Let’s check if the BIOS password is set on your Lenovo computer:

(gwmi -Class Lenovo_BiosPasswordSettings -Namespace root\wmi).PasswordState

If the command returned 0, then the BIOS security password is not set.

powershell Lenovo_BiosPasswordSettings

Change BIOS admin password on your Lenovo device:

(gwmi -Class Lenovo_SetBiosPassword -Namespace root\wmi).SetBiosPassword("pap,oldPassword,newPassword,ascii,us")

You can change some BIOS parameters on Lenovo computers. For example, let’s enable WOL (Wake-On-LAN):

$getLenovoBIOS = gwmi -class Lenovo_SetBiosSetting -namespace root\wmi
$getLenovoBIOS.SetBiosSetting("WakeOnLAN,Enable")
$SaveLenovoBIOS = (gwmi -class Lenovo_SaveBiosSettings -namespace root\wmi)
$SaveLenovoBIOS.SaveBiosSettings()

Reset your Lenovo device’s BIOS settings to factory defaults:

$DefaultSettings = Get-WmiObject -Namespace root\wmi -Class Lenovo_LoadDefaultSettings
$DefaultSettings.LoadDefaultSettings("CurrentBIOSPassword,ascii,us")

PowerShell: List and Change BIOS Settings on HP Computers

You can list the available BIOS options, their values, and available options on Hewlett Packard computers/laptops using the following command:

Get-WmiObject -Namespace root/hp/instrumentedBIOS -Class hp_biosEnumeration | select Name, value, possiblevalues –AutoSize

On HP computers, you can use PowerShell to change some BIOS settings. For example, you can disable the ability to boot your computer from a USB storage device.

$getHPBios = gwmi -class hp_biossettinginterface -Namespace "root\hp\instrumentedbios"
$getHPBios.SetBIOSSetting('USB Storage Boot','Disable')

If a password is required to change BIOS settings on an HP device, you can use this script:

$HPBIOSPassword = "<utf-16/>"+"Passw0rd!1"
$getHPBios = gwmi -class hp_biossettinginterface -Namespace "root\hp\instrumentedbios"
$getHPBios.SetBIOSSetting(‘Network (PXE) Boot','Disable',$HPBIOSPassword)

If the last command has returned “0”, it was successfully executed. You can use a simple PowerShell handler:

$ChangeBIOS_State = $bios.setbiossetting(Network (PXE) Boot', 'Disable' , $HPBIOSPassword)
$ChangeBIOS_State_Code = $ChangeBIOS_State.return
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 Switching in BIOS on an HP laptop to automatically disconnect from Wi-Fi when an Ethernet connection is available, run this command:

$getHPBios.SetBIOSSetting('LAN/WLAN Switching','Enable')

You can also install the HP Client Management Script Library (CMSL) extension on your Hewlett-Packard device (https://www.hp.com/us-en/solutions/client-management-solutions/download.html). CMSL includes several PowerShell modules that allow you to get or change BIOS/UEFU settings, update firmware, etc.

Export the current BIOS settings to a text file:

Get-HPBIOSSettingsList | Out-File -FilePath ‘C:\ProgramData\HP\CMSL\Logs\CurrentBIOSSettings.txt’

Enable the WLAN Auto Switching option in the HP BIOS settings:

Set-HPBIOSSettingValue -Name "LAN/WLAN Auto Switching" -Value Enable -Password BiosPass000rd

Configure DELL BIOS Settings with PowerShell

You can view and manage BIOS settings on DELL computers using the DCIM-BIOSService WMI class or the modern root\dellomci class (available after installing OMCI, Open Manage Client Instrumentation).

To view the boot device order in BIOS on Dell computers, run the following command:

Get-WmiObject -NameSpace root\dellomci Dell_BootDeviceSequence | sort bootorder | select BootDeviceName, BootOrder

dellomci class to view and change bios setting on dell computers with powershell

For example, you can enable Wake on LAN in the BIOS like this:

(Get-WmiObject DCIM-BIOSService -namespace rootdcimsysman).SetBIOSAttributes($null,$null,"Wake-On-LAN","4")

In addition, for Dell computers, you can use the official DellBIOSProvider PowerShell module, which is installed as part of the driver installation process, or you can manually install it with the command:

Install-Module -Name DellBIOSProvider -Force

For example, you can use this module to get the boot order on your Dell computer:

Get-Item DellSmbios:\BootSequence\Bootsequence

Check that the BIOS password is set:

Get-Item -Path DellSmbios:\Security\IsAdminPasswordSet

Change BIOS security password on a Dell device:

Set-Item -Path Dellsmbios\Security\AdminPassword –Value BadDellPa$$ –Password G00dDe11P@ss

We had a look at how to use PowerShell to get and change BIOS settings on Windows devices.  This allows you to unify the BIOS/UEFI settings on all your computers (using SCCM, Intune, MDT, etc.).

6 comments
7
Facebook Twitter Google + Pinterest
PowerShellWindows 10Windows 11Windows Server 2019
previous post
How to Create UEFI Bootable USB Drive to Install Windows
next post
Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

Related Reading

Fix: Remote Desktop Licensing Mode is not Configured

August 24, 2023

Wi-Fi (Internet) Disconnects After Sleep or Hibernation on...

March 15, 2024

How to Install Remote Server Administration Tools (RSAT)...

March 17, 2024

How to Find the Source of Account Lockouts...

March 12, 2024

Managing Windows Firewall Rules with PowerShell

March 11, 2024

How to Delete Old User Profiles in Windows

March 15, 2024

How to Install and Configure Free Hyper-V Server...

March 16, 2024

How to Force Remove a Printer That Won’t...

March 15, 2024

6 comments

Shammi Suji April 29, 2020 - 10:53 am

Hello,

I need to remotely (using Anydesk software) check and enable Wake-on-lan in the Bios of a Lenovo C50-30 All-in-One Type F0B1.
https://pcsupport.lenovo.com/gb/en/products/desktops-and-all-in-ones/lenovo-c-series-all-in-ones/lenovo-c50-30-all-in-one/f0b1/f0b1003muk/s1006b81?linkTrack=Caps%3ABody_SearchProduct&searchType=6&keyWordSearch=S1006B81
Running windows 8.1

Please can you confirm the Lenovo powershell commands above will work on the Lenovo C50-30 All-in-One Type F0B1.

To avoid any command type errors driving me mad, can you please give me the exact powershell command:

to check the current bios Wake-on-lan settings, and
the exact powershell command to enable the bios Wake-on-lan settings.

This will be most helpful, Thank you
shammi

Reply
Tomi December 3, 2020 - 1:50 pm

Great. Thx very much.

Reply
David Walker April 29, 2021 - 10:14 pm

do not assume you must include the password in the parameters of the cmdlet, especially on consumer laptops, consumer desktops from HP. I put a password on my HP Spectre BIOS/UEFI and set my boot order to disable booting from USB. Then I ran the Powershell cmdlet to enable booting from USB, and it bypassed the password and changed the setting. I hope that is not the case in their business laptops.

Reply
ssrawati January 30, 2021 - 1:31 am

I want to know a AD user’s last login details including computer name, date,time etc.

Reply
Mac March 2, 2021 - 8:45 pm

SSRAWATI, your question has nothing to do with topic of this article. You’re best bet is to find an answer on Stack Overflow, Google, etc.

Reply
Tim March 18, 2021 - 4:12 pm

Hi,
so we had a powercut the other day and thank goodness our UPS saved the servers, but all the pcs shut down, now some came back on, others were turned on by other users and I turned some on, so is there a way for both Dell and HP computers to query through WMI, if their autostart option is enabled, for Dell it is under power management, AC Recovery. I am not 100% sure what it is for HP, dont have a spare HP I can boot up to have a look at.
Thanks for looking

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Install and Manage Windows Updates with PowerShell (PSWindowsUpdate)
  • How to Delete Old User Profiles in Windows
  • Fix: Remote Desktop Licensing Mode is not Configured
  • Configuring Port Forwarding in Windows
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • Adding Drivers into VMWare ESXi Installation Image
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top