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
2
Facebook Twitter Google + Pinterest
previous post
Windows 7: End of Support Notifications, Extended Security Updates Program
next post
Installing a Free Let’s Encrypt TLS/SSL Certificate on IIS Web Server / RDS

Related Reading

Create Organizational Units (OU) Structure in Active Directory...

May 17, 2022

Windows Security Won’t Open or Shows a Blank...

May 17, 2022

How to Manually Install Windows Updates from CAB...

May 16, 2022

RDS and RemoteApp Performance Issues on Windows Server...

May 16, 2022

Enable or Disable MFA for Users in Azure/Microsoft...

April 27, 2022

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 7
  • Windows Server 2019
  • Windows Server 2016
  • Windows Server 2012 R2
  • PowerShell
  • VMWare
  • Hyper-V
  • MS Office

Recent Posts

  • Create Organizational Units (OU) Structure in Active Directory with PowerShell

    May 17, 2022
  • Windows Security Won’t Open or Shows a Blank Screen on Windows 10/ 11

    May 17, 2022
  • How to Manually Install Windows Updates from CAB and MSU Files?

    May 16, 2022
  • RDS and RemoteApp Performance Issues on Windows Server 2019/2016

    May 16, 2022
  • Deploying Software (MSI Packages) Using Group Policy

    May 12, 2022
  • Updating VMware ESXi Host from the Command Line

    May 11, 2022
  • Enable or Disable MFA for Users in Azure/Microsoft 365

    April 27, 2022
  • Fix: You’ll Need a New App to Open This Windows Defender Link

    April 27, 2022
  • How to Reset an Active Directory User Password with PowerShell and ADUC?

    April 27, 2022
  • How to Completely Uninstall Previous Versions of Office with Removal Scripts?

    April 26, 2022

Follow us

woshub.com

ad

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • How to Find the Source of Account Lockouts in Active Directory domain?
  • Get-ADComputer: Find Computer Details in Active Directory with PowerShell
  • How to Create a UEFI Bootable USB Drive to Install Windows 10 or 7?
  • Adding Third-Party Drivers into VMWare ESXi 6.7 ISO Image
  • How to Delete Old User Profiles Using GPO and PowerShell?
  • Managing Printers and Drivers with PowerShell in Windows 10 / Server 2016
  • Managing User Photos in Active Directory Using ThumbnailPhoto Attribute
Footer Logo

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


Back To Top