IT Blog

HP: Remotely change Bios password with a script

by on Sep.24, 2008, under HP

Many people were looking how to change the Bios password remotely. Please read my previous post about the Bios settings. To set Bios password you will need Key scan codes the information about them is also given in my previous post.
So this is how you do it:

First we take the script form my previous post and slightly modify it.
1. The follwing script sets the Bios password to ‘password‘ on the machine that had not password set.

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, _
“Setup Password”, _
“<kbd/>191E1F1F11181320″
Next

2. The following script changes the Bios password from ‘password’  to 123′

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, _
“Setup Password”, _
“<kbd/>020304″, _
“<kbd/>191E1F1F11181320″
Next

3. The following script removes Bios password. In order to remove the password you still have to know what it is. In this case it is set to ‘password’

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, _
“Setup Password”, _
“<kbd/>”, _
“<kbd/>191E1F1F11181320″
Next

This only been tested on HP laptops and desktops(nc6400,nc6220, 6910p, dc7600). Also HP CIM must be installed.

Feel free to post you comments.

:, , , , ,

10 Comments for this entry

  • Ryan Tregea

    What about capital letters, i’m having awful trouble getting it to work, luckily the script always generates the same scan codes so i can always blank it by modifying the script, however i can’t use capitals in my keyboard scan codes, otherwise i can’t login to the management interface program.
    an Example password is. sESjWl8Q
    Putting left shift command in front of the capitals seems to have no effect. Same with make and break codes on either side.

    Please get back to me. Need help with this.

  • Andrius

    Hi,
    You cannot script capitals because the scan code is the same for capital as for the lowercase. The same applies for numbers and special characters. For example if you set password as ‘!abc’ then the following combinations would also work ‘1abc’ ‘1Abc’ ‘!ABC’ and so on.

  • Tord Haakstad

    Hi,

    thanks for this script.
    But on the new Elitebook models, e.g.2530P and 8530P nothing happens. Do you have any experience with the new models with the GUI BIOS?

  • Darksun777

    As posted above, on the new 8530p model this is not working anymore.
    Always get the error “5 – Invalid parameter”

    Any suggestions to set/change the BIOS password on this models?

    • Andrius

      Hi,
      I’m not sure why you are getting this error because 6910p and 8530p shares the same SMBIOS version 2.4. I think there was a small change somewhere which is preventing to use the script. Because I don’t have 8530p I cannot find out what is missing. Probably it is possible to use HP ProtectTools Security Manager:BIOS Configuration for HP ProtectTools to do password changes, but I have not tried it myself.

  • winhan

    There is a new HP CMI softpaq download at http://h20331.www2.hp.com/Hpsub/cache/284014-0-0-225-121.html which may help people with the EliteBook series like the 6930p & 8530p.

  • Jack

    Thanks so much.

    I am using HP nc6220. I’ve installed HP CIM and know my
    Boot Order = Notebook Multibay 1, Notebook Multibay 2, USB Hard Drive, Hard Drive (C:), USB Floppy, USB LS-120 Drive, USB CD ROM, Network Controller

    Now I want to re-order it to:
    Boot Order = Notebook Multibay 1, Notebook Multibay 2, Hard Drive (C:), USB Hard Drive, USB Floppy, USB LS-120 Drive, USB CD ROM, Network Controller

    Can u help me to write a script to do change the Boot Order Setting. Thank you in advance.

    P/S: I’ve tried to use F10 and F12 when booting but nothing happended.

  • Tim

    You can actually use capitals in the kbd codes. I discovered kbd string for the capitals in the passwords we use for securing bios setup by using the following code after installing HP CMI.

    Dim oPwdCtl, strPassword
    Set oPwdCtl = CreateObject(“hpPwdCtl.PasswordEdit”)
    oPwdCtl.GetPassword “Enter the Computer Setup Password:”, _
    strPassword
    MsgBox strPassword

    This code will not set the bios password but will output the kbd string with the capitalised characters.

    Hope this helps!

  • Mayur Anandache

    Hi,

    I want the script to change the BIOS settings. Will you please mail me the scripts and instructions to use those as we have 1000 systems and need to do the BIOS settings manually.

    thanks

1 Trackback or Pingback for this entry

Leave a Reply