Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

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

September 13, 2023 PowerShellWindows 10Windows 11Windows Server 2019

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
6
Facebook Twitter Google + Pinterest
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

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

October 15, 2023

How to Query and Change Teams User Presence...

October 8, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

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

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

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

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


Back To Top