HP BCU to HP CMSL

HP BIOS Configuration Utility (BCU) has been around since longer than I’ve been a system administrator, I can’t find the exact date it was released, but it’s been around for a while.

Back in 2022, HP deprecated it and said no development was going to be made moving forward.

Well, HP decided to continue supporting BCU out of the kindness of their hearts, but I think this was a pretty clear statement to suggest customers should be moving away from BCU.

This first post will cover the basics of using PowerShell to manage BIOS and demo a few BCU commands that you can do in PowerShell / CMSL. I’ll plan in the near future to go a bit more fancy in a way to convert your BCU configs over to PowerShell but let’s start with basics. [HP BCU to CMSL Part 2]

Why switch to anything other than BCU?

HP BIOS has had the ability to manage the BIOS via direct WMI calls since before I started to manage HPs, and that’s how I first started, finding resources from the community. With PowerShell today, it’s very easy to script BIOS management. Available alternatives to BCU:

  • PowerShell – Direct WMI Methods
    • Tons of Community Scripts, which I’ll get to later in the post
    • WMI Interface Whitepaper (From 2005, so you know it’s been around awhile)
  • HP CMSL – PowerShell Module from HP to help manage BIOS (and more)
  • HP Connect – Cloud based management of HP BIOS Settings, Passwords & Updates
    • Leverages PowerShell under the hood
  • Future: HP WEX – Cloud Platform “One platform to transform IT for your workforce”

Advantages of using PowerShell

  • One script for all models
  • No managing of the BCU exe and associated config files
  • It’s PowerShell, so all of the greatness that comes with it!
    • Custom Logging
    • Making dynamic
    • It’s already built into Windows
    • Admins all know it, easy to share and peer review

WMI Locations for HP

  • Namespace: ROOT\HP\InstrumentedBIOS”
    • Settings
      • Classname: HP_BIOSEnumeration
      • Classname: HP_BIOSSetting
    • Methods
      • Classname: HP_BIOSSettingInterface

Finding things in WMI w/ WMI Explorer

It’s often nice to poke around in a visual explorer, so WMI Explorer is great for this. You can look around, confirm what Properties are available, and use that information to assist in your scripting

Nifty way to lookup what parameters you can pass into the interface:

PowerShell – Basic Setup for HP BIOS WMI Connection

First we will look for settings that we can update:

#Connect to the HP_BIOSEnumeration WMI class & Capture Settings & Write out
$SettingsList = Get-CimInstance -Namespace root\hp\instrumentedBIOS -ClassName HP_BIOSEnumeration
$SettingsList | Select-Object -Property Name, CurrentValue

Note, there are a lot more properties you can use for sorting and finding information, along with the available options for each setting.

Now we’ll connect to the Interface so we can make changes:

#Connect to Interface
$Bios = Get-CimInstance -Namespace root/HP/InstrumentedBIOS -ClassName HP_BIOSSettingInterface

#Change a Value
$Bios | Invoke-CimMethod -MethodName SetBIOSSetting -Arguments @{Name = 'Fast Boot'; Value = 'Disable'}

Dealing with BIOS Setup Password get slightly trickier, as you’ll have to add that information into the arguments. The BIOS only reads passwords in utf-16 encoding, so you’ll need to set that. Then pass the password into your argument list.

$BIOSPassword = 'P@ssw0rd' #Set your Password here - if using a TS, I recommend a hidden variable
$BIOSPasswordUTF = "<utf-16/>$BIOSPassword" #Must be set to UTF-16 for BIOS to read correctly
$Bios = Get-CimInstance -Namespace root/HP/InstrumentedBIOS -ClassName HP_BIOSSettingInterface
$Bios | Invoke-CimMethod -MethodName SetBIOSSetting -Arguments @{Name = 'Fast Boot'; Value = 'Disable'; Password = "$BIOSPasswordUTF"}

So at this point, you know the basics of using PowerShell to connect with WMI to manage your HP BIOS Settings.

HP CMSL

HP CMSL was created to simplify the code for BIOS Settings and HP Management Automation. I’m just going to cover a small portion of what CMSL can do in this post, focused on BIOS Setting Management

HP has pretty good documentation around the functions they’ve created, which allows you to do a lot of things you typically wouldn’t think of doing in the BIOS, like changing the logo.

Mapping BCU Features to Native PowerShell & CMSL

I’ll be breaking down using PowerShell code to get info from WMI, and how to replace your BCU features with native PowerShell or CMSL

#Get Value
.\BiosConfigUtility64.exe /getvalue:"Fast Boot"

Get-CimInstance -Namespace root\hp/InstrumentedBIOS -ClassName HP_BIOSEnumeration | Where-Object {$_.Name -eq "Fast Boot"}

Get-HPBIOSSetting -Name "Fast Boot"
#Set Value
.\BiosConfigUtility64.exe /setvalue:"Fast Boot","Disable"

#Connect to Interface (Only needs to be done once per script)
$Bios = Get-CimInstance -Namespace root/HP/InstrumentedBIOS -ClassName HP_BIOSSettingInterface
#Set Setting Value
$Bios | Invoke-CimMethod -MethodName SetBIOSSetting -Arguments @{Name = 'Fast Boot'; Value = 'Disable'}

Set-HPBIOSSettingValue -Name "Fast Boot" -Value "Disable"

Dealing with Passwords

Setting a password & Clearing a Password. In each example I’ll be setting the password to P@ssw0rd, using CMSL to confirm a password is set, then clearing the password, and then using CMSL to confirm the password is no longer set.

BCU

.\BiosConfigUtility64.exe /nspwdfile:"MyPassword.bin"
.\BiosConfigUtility64.exe /nspwdfile:"" /cspwdfile:"MyPassword.bin"

PowerShell native

$BIOSPassword = 'P@ssw0rd' #Set your Password here - if using a TS, I recommend a hidden variable
$BIOSPasswordUTF = "<utf-16/>$BIOSPassword" #Must be set to UTF-16 for BIOS to read correctly
$Bios = Get-CimInstance -Namespace root/HP/InstrumentedBIOS -ClassName HP_BIOSSettingInterface
#SET:
$Bios | Invoke-CimMethod -MethodName SetBIOSSetting -Arguments @{Name = 'Setup Password'; Value = $BIOSPasswordUTF; Password = "<utf-16/>"}
#CLEAR:
$Bios | Invoke-CimMethod -MethodName SetBIOSSetting -Arguments @{Name = 'Setup Password'; Value = "<utf-16/>"; Password = $BIOSPasswordUTF }

CMSL

Set-HPBIOSSetupPassword -NewPassword P@ssw0rd
Clear-HPBIOSSetupPassword -Password P@ssw0rd

NOTE: Checking for Set Password:

(Get-CimInstance -Namespace root\hp/InstrumentedBIOS -ClassName HP_BIOSSetting | Where-Object {$_.Name -eq "Setup Password"}).IsSet
Get-HPBIOSSetupPasswordIsSet

Scripting with PowerShell – Native WMI

[Sample on GitHub]

This is where we’ll go through and set a pile of settings to what we want them to be. You can do this so many different ways, so it’s really up to you on how fancy you want to be. There are some great examples on other blogs where you can create a table of settings and loop through, so I’ll just keep it simple here and link to some good posts at the end of the post.

This is where you will need to test each model, as sometimes setting names have changed, and I hate to say it, from time to time, I’ve heard (not confirmed personally) that a setting name might change during an update.

So how I do it in my script is basically shotgun it, I add all of the settings from every model, and try to set them. If it works, you’ll get Return 0, otherwise, it returns 4 (basically can’t find the setting).

So basically, this script, you’re setting the password for your environment (Sorry, I’m not going to deal with Sure Admin here, if you want that, I recommend using HP Connect), then it starts to set settings. This script will work for devices with or without passwords. If the script detects you have a password set, it will double check your password and if it’s not correct, it will write warning that it’s the wrong password, along with the fact you’ll get return 6 on all of the settings.

At this point, you can start to make the script a lot more useful by adding logging, try / catch, custom exits, etc. But for my goal of providing basic replacement for BCU, I think I’ve got you covered.

Scripting with PowerShell – HP CMSL

[Sample on GitHub]

This is basically the same as above, but instead of native WMI calls, you can see how the CMSL code would work and the slightly different syntax used.

You can see that CMSL adds friendly names to things which makes troubleshooting easier and logging easier to read.

Wrapping Up

So this should be a good start to get you on your way with HP BIOS management via PowerShell. If you’d like me to go any deeper on anything, please comment or find me on X / discord and I’ll be happy to explain in more detail.

My Favorite Community Script: HP BIOS Settings Management – Jon’s Notes (configjon.com)
Jon has done a lot of work and goes all out adding in Password support, nice logging, testing of settings. Basically, I’d start with his script and modify to my own needs (which is what I did in my lab a year back).
I’d also look into updating it from Get-WMIObject to Get-CIMInstance if I was using in production.

Jon also shows a bit about using it a Task Sequence, which I didn’t cover in this post, but would be happy to go into deeper too if requested.

Community Links

You can also do a search on GitHub for “HP_BIOSSettingInterface” and you’ll get a lot of hits of people using PowerShell to manage BIOS Settings
Code search results (github.com)

1 thought on “HP BCU to HP CMSL”

  1. Have been using HP CMSL and Native WMI to resolve some bios configuration issues. I have picked up that in some instances you need to set “Configure Legacy Support and Secure Boot” before you can set “Secure Boot”.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.