HP: Remotely change BIOS settings with script

18 Jan

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

Download

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

Download

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

Tags: , , , , , ,

39 Responses

  1. P says:

    Can I use the first script with HP compaq NC6220 laptop? Please recommend.

  2. Andrius says:

    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.

  3. Paul R says:

    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

  4. Andrius says:

    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.

  5. P says:

    I try to running second script with HP NC6220. The result is error following :
    Line : 13
    Char: 1
    Error : 0x8004100E
    Code : 8004100E
    Source: (null)
    How to use the script with other HP series that have difference menu for set bios?

  6. Andrius says:

    Hi P,
    You are missing CMI on the laptop. Please read my note I’ve added to the post at the bottom.

  7. P says:

    Thank you Andrius.

  8. Peter says:

    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.

  9. Andrius says:

    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.

  10. Peter says:

    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.

  11. Andrius says:

    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.

  12. Peter says:

    Oke I understand thank you for your answer.

  13. Anthony says:

    I am trying to use the second script on Vista and getting bios-setting.vbs(17, 1) (null) 0x80041003

    Is this to do with CMI not being installed?

    Regards
    Anthony

  14. Anthony says:

    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

  15. Frank S. says:

    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!

  16. Cal says:

    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!

  17. Andrius says:

    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.

  18. Merlus says:

    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.

  19. Andrius says:

    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/

  20. EBo says:

    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

  21. Robin says:

    You can get thing to make the string, hpPwdCtl.exe
    from here: ftp://ftp.compaq.com/pub/softpaq/sp33001-33500/sp33341.exe

  22. G says:

    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

  23. Ryan says:

    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”, _

  24. Tom says:

    Do you know if there is a way to change bios settings on HP/Compaq desktops?

    Thanks!

  25. robert says:

    i have HP laptop 6730b i lost my windows login password how get relog my system

  26. Nate says:

    I’m trying to access all the settings in the BIOS of this HP Compaq 6910p. After a successful windows 7 install the Intel 965GM chip-set is not registering the correct memory. There should be a setting in the BIOS to change this but it is not viewable or changeable that I have found thus far. Any help would be appreciated. I tired your script from above and it fails to run on Win 7 platform.

    • Andrius says:

      Hi, can you explain in more details what is happening with memory.
      There is nothing you can change in the BIOS. How much RAM do you have? What version of Win7 are you using 32bit or 64bit?

  27. Nate says:

    Running windows 7 64 bit (4GB Ram). All sources are indication that the Integrated Graphics only has access to 384 MB of ram when under vista 32 bit (3GB Ram) it had access to 448 MB. After reading documentation on the graphics controller it supports up to 512 MB allocation changed within the BIOS, or so I’m told. The games that I play indicate that I’m running out of ram when in fact I have over 2GB of unused ram always.

    • Andrius says:

      6910p is a weak laptop for games.
      There is no way to change allocated memory for video card in the Bios as it is done automatically.

  28. Nate says:

    Thanks for checking, I know I just wanted to make the best out of what I have. Guess I’ll invest in upgrading my desktop and making a custom transportable case for the future.

  29. Michael Dal Lago says:

    We have used the LAN/WAN script on out onlder 6510 laptops, but need to know if they will work on newer 6450 where the BIOS looks different

    • Andrius says:

      Just run the settings script and see if it works. If it does not then it means you’ll have to investigate what was changed.

  30. Tyson says:

    This is absolutely awesome. Thank you so much for posting this, as it has helped me immensely.

  31. Anders says:

    Thank you!

    This has work successfully on all our hp laptops independent on OS. WLAN being on while connected via cable createt alot of interesting problems for us so this was great.

    The script can be run on every computer but only does something to computers that support WLAN switching. This makes i easy to deploy if you can send it to everyone without checking if it is a laptop or not.

  32. Macc says:

    so what does really do? im no expert in this kind of field.. but i want to know how this works? i have a Compaq Presario CQ50-215NR Notebook PC which i need to upgrade it on windows 7 but i can find the boot settings on the phenixbios setup utilities, how is that possible? in my other notebook samsung, i dont have this kind of matter. thanks for posting this script.. i hope you can enlighten my thoughts about this matter.. thanks.

    • Andrius says:

      I do not think this will work on presario as they are suing different bios compared to Business class laptops.

  33. Cristian says:

    Nice post.
    I will add that if working with servers (proliant, for example) the equivalent to CMI is “WBEM”, a part of the Management Insight Agents.

    Without WBEM, namespace (root/HP…) is inexistent.

    cheers.
    CZ

  34. Cristian says:

    Nice post.
    I will add that if working with servers (proliant, for example) the equivalent to CMI is “WBEM”, a part of the Management Insight Agents.

    Without WBEM, namespace (root/HP…) is inexistent.

    cheers.
    CZ

  35. I edited your bios-setting.vbs script to output a TXT file with the date and time. So instead of outputting bios-setting.txt, it will output bios-setting-Date-Time.txt

    Dim objFileSystem, objOutputFile, objfilename
    Dim strOutputFile
    Const wbemFlagReturnImmediately = 16
    Const wbemFlagForwardOnly = 32
    lFlags = wbemFlagReturnImmediately + wbemFlagForwardOnly
    strOutputFile = “./” & Split(WScript.ScriptName, “.”)(0) & “-”
    strService = “winmgmts:{impersonationlevel=impersonate}//”
    strComputer = “.”
    strNamespace = “/root/HP/InstrumentedBIOS”
    strfileName = strOutputFile & replace(replace(date,”/”,”_”),”:”,”_”) & “_” & replace(replace(time,”:”,”_”),”:”,”_”) & “_” & strDatabaseName & “.txt”
    strQuery = “select * from HP_BIOSSetting”
    Set objFileSystem = CreateObject(“Scripting.fileSystemObject”)
    Set objOutputFile = objFileSystem.CreateTextFile(strfileName, 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

Leave a Reply

IT Blog

Just another blog on Kozeniauskas.com Network