none
Setup BIOS password using PowerShell RRS feed

  • Question

  • Hello Scripting Guys!!! 

    I am trying to setup BIOS password using PowerShell for HP Elite 8300 Desktop, I have been changing the BIOS settings for these HP machines using HP_BIOSSettingInterface class and the changes are successfully only the last part is to setup the password using PowerShell.

    Your help would be highly appreciated.

    Faraz Amjad


    • Edited by Faraz_pk Sunday, December 28, 2014 11:32 AM
    Sunday, December 28, 2014 11:06 AM

Answers

  • Hi Jrv,

    This is possible, I finally got the script running. HP has mentioned in its CMI technical white paper to use <UTF-16 /> as you mention your password so the following works perfectly.

    $passChange= Get-WmiObject -computername "PCNAME" -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface 

    $passChange.SetBIOSSetting('Setup Password', '<utf-16/> NewPassword', '')

    This script is good for setting up the password when the current password is blank

    Faraz Amjad


    • Edited by Faraz_pk Monday, January 5, 2015 10:47 AM
    • Marked as answer by Faraz_pk Monday, January 5, 2015 10:47 AM
    Monday, January 5, 2015 10:36 AM

All replies

  • Hello Scripting Guys!!! 

    I am trying to setup BIOS password using PowerShell for HP Elite 8300 Desktop, I have been changing the BIOS settings for these HP machines using HP_BIOSSettingInterface class and the changes are successfully only the last part is to setup the password using PowerShell.

    Your help would be highly appreciated.

    Faraz Amjad


    I don't think thisis possiblle with PowerSHell/WMI.  HP may have a utility to do this.  I know that it could only bedone inthe past with ILO mnagement tools.

    Post you issue int he HP forum for systems management.


    ¯\_(ツ)_/¯

    • Proposed as answer by jrv Sunday, December 28, 2014 2:08 PM
    • Marked as answer by Faraz_pk Monday, December 29, 2014 5:36 AM
    • Unmarked as answer by Faraz_pk Monday, January 5, 2015 10:47 AM
    • Unproposed as answer by Faraz_pk Monday, January 5, 2015 10:47 AM
    Sunday, December 28, 2014 2:08 PM
  • Here is a blog about how this can be done on older HP systems. Check with HP if it no longer works on newer systems.

    http://www.kozeniauskas.com/itblog/2008/09/24/hp-remotely-change-bios-password-with-a-script/


    ¯\_(ツ)_/¯


    • Edited by jrv Sunday, December 28, 2014 2:15 PM
    Sunday, December 28, 2014 2:14 PM
  • Thanks for the advise Jrv, I shall check with HP

    Faraz Amjad

    Monday, December 29, 2014 5:36 AM
  • Hi Jrv,

    This is possible, I finally got the script running. HP has mentioned in its CMI technical white paper to use <UTF-16 /> as you mention your password so the following works perfectly.

    $passChange= Get-WmiObject -computername "PCNAME" -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface 

    $passChange.SetBIOSSetting('Setup Password', '<utf-16/> NewPassword', '')

    This script is good for setting up the password when the current password is blank

    Faraz Amjad


    • Edited by Faraz_pk Monday, January 5, 2015 10:47 AM
    • Marked as answer by Faraz_pk Monday, January 5, 2015 10:47 AM
    Monday, January 5, 2015 10:36 AM
  • Hi Faraz_pk

    I am using this script but it is not working. It is giving return value "6" that means access denied. Please let me know how to resolve this issue.

    Thank You

    Tuesday, August 22, 2017 9:12 AM
  • 6 is not access denied.

    Please do not add new questions to very old and answered questions.  Please start you own question with a complete description of your issue.


    \_(ツ)_/

    Tuesday, August 22, 2017 1:26 PM
  • Right from HP's documentation:

    6
    Access Denied

    WMI result code – Setting modification failed due to BIOS permissions.

    We are working through similar issues and I can confirm that 6 is an access denied from an incorrect password.  When using the SetBIOSSetting on the HP_BIOSSetingInterface class, you will need to precede BOTH the new and old passwords using the <utf-16/> tags enclosed in quotes in the form:

    (Get-WmiObject -computername $computerName -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface).SetBIOSSetting('Setup Password', '<utf-16/>NewPass', '<utf-16/>OldPass').

    Hope this helps,

    -rm

    Saturday, February 3, 2018 12:22 AM
  • WMI 6 is "Invalid Handle"  WM 5 is "Access Denied"

    HP returns invalid handle when the password is incorrect.  THe low value eturn codes can all be found like this:

    net helpmsg 5
    net helpmsg 6

    Each vendor can handle this in different ways. HP returns "invalid handle".  I believe Dell returns "Invalid Parameter".  Both signal a failure of the method call but indicate the method call succeeded.

    Note that this thread is 4 years old.  The thread was already marked as answered and the answer worked 4 years ago.  Current HP BIOs usually require "utf-16" on the empty string when setting a blank password.


    \_(ツ)_/



    • Edited by jrv Saturday, February 3, 2018 12:43 AM
    Saturday, February 3, 2018 12:41 AM