Skip to content

Instantly share code, notes, and snippets.

@bmkaiser
Last active January 29, 2024 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmkaiser/a6f36c0a8a4467a443cf5c1d0adac8c6 to your computer and use it in GitHub Desktop.
Save bmkaiser/a6f36c0a8a4467a443cf5c1d0adac8c6 to your computer and use it in GitHub Desktop.
How to Query and Assign HP BIOS Settings Using WMI
param (
[Parameter(Mandatory=$true)]
[string[]]
$ComputerName
)
#region GET BIOS SETTINGS
$filter = @(
"Name like '%day'"
"Name like 'BIOS Power-On%'"
"Name like '%Wake On LAN'"
"Name like 'After Power Loss'"
)
$filter = $filter -join ' OR '
$biosSettings = Get-CimInstance -Namespace root\HP\InstrumentedBIOS -ClassName HP_BIOSSetting -ComputerName $ComputerName -Filter $filter
$biosSettings | Select-Object -Property @{
Name='ComputerName'; Expression={$PSItem.PSComputerName}}, @{
Name='Property'; Expression={$PSItem.Name}}, @{
Name='Value'; Expression={$PSItem.CurrentValue}} |
Sort-Object -Property ComputerName, Property
#endregion
#region SET BIOS SETTINGS
$settingsList = @{
'BIOS Power-On Hour' = 23
'BIOS Power-On Minute' = 0
'Monday' = 'Enable'
'Tuesday' = 'Enable'
'Wednesday' = 'Enable'
'Thursday' = 'Enable'
'Friday' = 'Enable'
'Saturday' = 'Enable'
'Sunday' = 'Enable'
'After Power Loss' = 'Power On'
'Wake On LAN' = 'Boot to Hard Drive'
}
$biosInterface = Get-CimInstance -Namespace root\HP\InstrumentedBIOS -ClassName HP_BIOSSettingInterface -ComputerName $ComputerName
foreach ($setting in $settingsList.GetEnumerator()) {
$biosInterface.SetBIOSSetting($setting.Name,$setting.Value)
}
#endregion
@bmkaiser
Copy link
Author

bmkaiser commented Jun 5, 2020

Overview

How to leverage HP's WMI classes to get and set BIOS settings on their hardware.

Resources & Documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment