Couple months ago I needed to change BIOS setting on all our HP laptops. I wanted to do that remotely because we have many laptops and they are in 5 different locations. After spending some time searching I found very good document from HP.
HP Client Management Interface Technical White Paper
After some modifications I came up with the following VB script. This script enables LAN/WLAN Switching setting in the BIOS. Because all the laptops are password protected I had to include BIOS password in the script. The password line is “<kbd/>191E1F1F11181320″ which is password. As described in the HP document: ‘kbd’ denotes a string in hexadecimal format containing keyboard scan code input.
You can find keyboard scan codes here. Once I had the script I’ve used SMS2003 to deployed on the laptops. You can easely Active Directory to run the script on start-up.
Const wbemFlagReturnImmediately = 16
Const wbemFlagForwardOnly = 32
lFlags = wbemFlagReturnImmediately + wbemFlagForwardOnly
strService = “winmgmts:{impersonationlevel=impersonate}//”
strComputer = “.”
strNamespace = “/root/HP/InstrumentedBIOS”
strQuery = “select * from HP_BIOSSettingInterface”
Set objWMIService = GetObject(strService & _
strComputer & strNamespace)
Set colItems = objWMIService.ExecQuery(strQuery,,lFlags)
For each objItem in colItems
objItem.SetBiosSetting oReturn, _
“LAN/WLAN Switching”, _
“Enable”, _
“<kbd/>191E1F1F11181320″
Next
Also I’ve wrote a script which will list all setting in the BIOS. It will also show possible options for setting and which one is set. This creates a *.txt file.
Dim objFileSystem, objOutputFile
Dim strOutputFile
Const wbemFlagReturnImmediately = 16
Const wbemFlagForwardOnly = 32
lFlags = wbemFlagReturnImmediately + wbemFlagForwardOnly
strOutputFile = “./” & Split(WScript.ScriptName, “.”)(0) & “.txt”
strService = “winmgmts:{impersonationlevel=impersonate}//”
strComputer = “.”
strNamespace = “/root/HP/InstrumentedBIOS”
strQuery = “select * from HP_BIOSSetting”
Set objFileSystem = CreateObject(”Scripting.fileSystemObject”)
Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)
Set objWMIService = GetObject(strService & strComputer & _
strNamespace)
Set colItems = objWMIService.ExecQuery(strQuery,,lFlags)
Counter = 1
For Each objItem In colItems
objOutputFile.WriteLine(Counter & vbTab & objItem.Name & _
“ = ” & objItem.Value)
Counter = Counter + 1
Next
objOutputFile.Close
Set objFileSystem = Nothing
Scripts were tested on HP Compaq nc6400 and HP Compaq 6910p laptops, both of them running WinXP SP2. The second script was also tested on HP dc7600 ultra slim PC.
Note: I’ve found out that some desktops and laptops (like nc6220) does not have CMI installed and the scripts don’t work without CMI. You can download it from here. (SP33341)
Update: For all of you who want to change Bios password I’ve created a separe post about it. Remotely change Bios password with a script





Can I use the first script with HP compaq NC6220 laptop? Please recommend.
It should work as there should not be too many diferences. But I cannot guarantee as it was not tested on nc6220. I would recommend running second script first to get all possible options and then modify first script if needed.
I am looking to only gather the ownership tag from this same data. I have run your script and it works a treat but I only need the Ownership data. I think I was shown on line 17.
Do you know how I could extract only this information?
Thanks
P
Hi Paul,
the simplest way to get that info is through command line. Just type in the following line in command prompt.
wmic /namespace:\\root\HP\InstrumentedBios path HP_BIOSString where (name=”Ownership Tag”) get Value /value
This will show you ‘Ownership Tag’ value. The field might be named diferenly on your Bios. In that case just replace ‘Ownership Tag’ with the name you have in your line 17.
I try to running second script with HP NC6220. The result is error following :
Line : 13
Char: 1
Error : 0×8004100E
Code : 8004100E
Source: (null)
How to use the script with other HP series that have difference menu for set bios?
Hi P,
You are missing CMI on the laptop. Please read my note I’ve added to the post at the bottom.
Thank you Andrius.
I have use the second script and a textfile appear but in the textfile i dont see the bios password. I see Setup Password = and Power-On Password = Why cant i see these passwords. My bios is password protected. I have a compaq nc6220. My english is not so good so forgive for my english.
Hi Peter,
you will not see the password as they are secure. Otherwise there would be no point setting passwords if a simple script can show them.
Oke i understand but my wireless is disabled how can i enable my wireless. Can the script do that for me. Or can i not change my bios settings with the scribt.
Hi Peter,
you can enable your wireless using the script as long as you know Setup/Bios password. Which you have to provided as described in the post.
At first you need to find out what is the setting name. You can do that by running the second script.
When you get the name change the line “LAN/WLAN Switching” in the first script to the setting name you got and that should enable WLAN card.
Oke I understand thank you for your answer.
I am trying to use the second script on Vista and getting bios-setting.vbs(17, 1) (null) 0×80041003
Is this to do with CMI not being installed?
Regards
Anthony
Figured it out. Even though I was logged on as an admin I had to select to run the script as an admin. Damn Vista
Regards
Anthony
We have 200+ HP DC7800 workstations on site. We would like to change the BIOS Setup Passwaord without having to visit each workstation. We already have a password in place and we need to change the current password. Is there a way to accomplish this using a vbs file? PLease advise.
Thank you for your help!
I have 150+ HP laptops and need to enable the password. I ran the script that lists all the setting.
Question….how would I script this? Any help is greatly appreciated!
Hi everyone,
I see many requests on changing BIOS password via scripts. I have not done that myself but I’ll do that in coming weeks and write a new post on that.
To set the setup password or power on password it is very easy using the script provided in this blog.
All you need to do is modify the LAN/WLAN Switching to “Setup Password”
Then you enter the password in the form of “hexformat” He also provided the link to the hex codes.
Very easy, thanks heaps for this script. Save me much time.
Thank you Merlus for your input. Finally I’ve found some time to write the post on BIOS passwords. http://andrius.kozeniauskas.com/blog/2008/09/24/hp-remotely-change-bios-password-with-a-script/
Hi I am having trouble to run this on HP NC6120 with Windows 2000, CAn someone confirm that CMI is working on this OS. XP on same model(not same machine) working fine. Thanks
You can get thing to make the string, hpPwdCtl.exe
from here: ftp://ftp.compaq.com/pub/softpaq/sp33001-33500/sp33341.exe
Hi,
Did anybody try this script to find the status of power on password on HP workstations.
these script are able to read BIOS password ISset value but i dont know why its not giving correct value for BIOS —securit –> poweron password .
need help
What if we want to make multiple changes in the configuration via script, say Enable LAN/WAN switching and Disable the Fingerprint Device, what is the switch between?
For each objItem in colItems
objItem.SetBiosSetting oReturn, _
“LAN/WLAN Switching”, _
“Enable”, _
**WHAT GOES HERE TO MOVE ON TO THE NEXT REQUEST?**
For each objItem in colItems
objItem.SetBiosSetting oReturn, _
“Fingerprint Device”, _
“Disable”, _
Do you know if there is a way to change bios settings on HP/Compaq desktops?
Thanks!
i have HP laptop 6730b i lost my windows login password how get relog my system