Jan 18

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

20 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 : 0×8004100E
    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) 0×80041003

    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

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.