Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • 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 2012
    • 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 / Using PowerShell to View and Change BIOS Settings

December 30, 2019 PowerShellWindows 10

Using PowerShell to View and Change BIOS Settings

You can use PowerShell to view or change BIOS settings on your computer running Windows. Let’s consider some examples you can use to get or modify some BIOS settings with PowerShell through the WMI classes (Windows Management Instrumentation) on the computers of popular vendors: HP, Lenovo, Dell.

Contents:
  • Lenovo BIOS Settings Management from PowerShell
  • Change BIOS Setting from PowerShell on Hewlett-Packard Computers
  • Configuring DELL BIOS Settings with PowerShell

You can view basic BIOS parameters on your computer using the Get-WmiObject cmdlet from the Win32_BIOS class:

Get-WmiObject -Class Win32_BIOS | Format-List *

This command allows you to view your BIOS version (SMBIOSBIOSVersion, BIOSVersion), hardware manufacturer, computer serial number, the ReleaseDate and some other information.

Get-WmiObject Win32_BIOS

You can list only some of these BIOS parameters:

Get-WmiObject -Class Win32_BIOS | Select-Object Manufacturer, SMBIOSBIOSVersion

You can use the Win32_BIOS class to view some BIOS information on any computer running Windows. However, some hardware vendors provide special WMI classes to direct access BIOS from Windows OS (the native drivers by your hardware manufacturer must be installed on a computer).

Lenovo BIOS Settings Management from PowerShell

You can get the list of BIOS parameters and their values on Lenovo computers like this:

Get-WmiObject -class Lenovo_BiosSetting -namespace root\wmi

To display only the names of BIOS settings and their current values:

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

list all Lenovo_BiosSetting using powershell

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

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

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

powershell Lenovo_BiosPasswordSettings

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()

Change BIOS Setting from PowerShell on Hewlett-Packard Computers

To get BIOS settings, their values and available options on HP computers, you can use the following command:

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

You can change some BIOS settings on HP computers from PowerShell. For example, you want to disable booting your computer from USB devices.

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

If a password is required to change BIOS settings, 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 has been executed successfully. 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 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')

Configuring DELL BIOS Settings with PowerShell

To view and manage BIOS settings on DELL computers, you can use the DCIM-BIOSService WMI class or the more modern root\dellomci class (available after the installation of the OMCI package — 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 BIOS like that:

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

Also, Dell released a separate PowerShell module, DellBIOSProvider, which is installed alongside driver installation or you can install it manually with this command:

Install-Module -Name DellBIOSProvider -Force

You can use this module to view the boot sequence on a Dell computer:

Get-ChildItem DellSmbios:\BootSequence\Bootsequence

To change a specific BIOS setting, use the Set-Item cmdlet. For example, to change the BIOS password:

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

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). Then, you can use PowerShell to deploy the same BIOS settings on all computers in your company.

5 comments
4
Facebook Twitter Google + Pinterest
previous post
Fix: Photos App in Windows 10 Opens Extremely Slow
next post
Installing a Free Let’s Encrypt TLS/SSL Certificate on IIS Web Server / RDS

Related Reading

Configure User’s Folder Redirection with Group Policy

February 3, 2023

Disable Built-in PDF Viewer in Microsoft Edge

February 3, 2023

Join a Windows Computer to an Active Directory...

February 2, 2023

Using Previous Command History in PowerShell Console

January 31, 2023

How to Install the PowerShell Active Directory Module...

January 31, 2023

5 comments

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

  • Configure User’s Folder Redirection with Group Policy

    February 3, 2023
  • Using Previous Command History in PowerShell Console

    January 31, 2023
  • How to Install the PowerShell Active Directory Module and Manage AD?

    January 31, 2023
  • Finding Duplicate E-mail (SMTP) Addresses in Exchange

    January 27, 2023
  • How to Delete Old User Profiles in Windows?

    January 25, 2023
  • How to Install Free VMware Hypervisor (ESXi)?

    January 24, 2023
  • How to Enable TLS 1.2 on Windows?

    January 18, 2023
  • Allow or Prevent Non-Admin Users from Reboot/Shutdown Windows

    January 17, 2023
  • Fix: Can’t Extend Volume in Windows

    January 12, 2023
  • Wi-Fi (Internet) Disconnects After Sleep or Hibernation on Windows 10/11

    January 11, 2023

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Managing Printers and Drivers with PowerShell in Windows 10 / Server 2016
  • How to Create a UEFI Bootable USB Drive to Install Windows 10 or 7?
  • Deploy PowerShell Active Directory Module without Installing RSAT
  • Managing User Photos in Active Directory Using ThumbnailPhoto Attribute
  • RDP Brute Force Protection with PowerShell and Windows Firewall Rules
  • Active Directory Dynamic User Groups with PowerShell
  • Match Windows Disks to VMWare VMDK Files
Footer Logo

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


Back To Top