Last active
January 29, 2024 03:47
-
-
Save bmkaiser/a6f36c0a8a4467a443cf5c1d0adac8c6 to your computer and use it in GitHub Desktop.
How to Query and Assign HP BIOS Settings Using WMI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview
How to leverage HP's WMI classes to get and set BIOS settings on their hardware.
Resources & Documentation