Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 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.

1 comment
1
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

Preparing Windows for Adobe Flash End of Life...

January 22, 2021

Checking User Logon History in Active Directory Domain...

January 22, 2021

How to Disable/Remove Thumbs.db File on Network Folders...

January 21, 2021

USB Device Passthrough (Redirect) to Hyper-V Virtual Machine

January 15, 2021

Windows 10: No Internet Connection After Connecting to...

January 13, 2021

1 comment

Tomi December 3, 2020 - 1:50 pm

Great. Thx very much.

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Recent Posts

  • Preparing Windows for Adobe Flash End of Life on December 31, 2020

    January 22, 2021
  • Checking User Logon History in Active Directory Domain with PowerShell

    January 22, 2021
  • How to Disable/Remove Thumbs.db File on Network Folders in Windows?

    January 21, 2021
  • MS SQL Server 2019 Installation Guide: Basic Settings and Recommendations

    January 19, 2021
  • USB Device Passthrough (Redirect) to Hyper-V Virtual Machine

    January 15, 2021
  • Windows 10: No Internet Connection After Connecting to VPN Server

    January 13, 2021
  • Updating the PowerShell Version on Windows

    December 24, 2020
  • How to Enable and Configure User Disk Quotas in Windows?

    December 23, 2020
  • Restoring Deleted Active Directory Objects/Users

    December 21, 2020
  • Fix: Search Feature in Outlook is Not Working

    December 18, 2020

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Get-ADUser: Getting Active Directory Users Info via PowerShell
  • Install RSAT Feature on Demand on Windows 10 1809 and Later
  • Get-ADComputer: Find Computer Details in Active Directory with PowerShell
  • How to Create a UEFI Bootable USB Drive to Install Windows 10 or 7?
  • Managing Printers and Drivers with PowerShell in Windows 10 / Server 2016
  • How to Find the Source of Account Lockouts in Active Directory domain?
  • PSWindowsUpdate: Managing Windows Updates from PowerShell
Footer Logo

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


Back To Top