Change BIOS password through powershell

0

I want to build a script to change and/or set up BIOS password to HP workstations.

Script i run as follows:

C:\> $computers=Get-Content -Path c:\computers.txt
C:\> foreach ($computer in $computers) {
$passChange=Get-WmiObject -computername $computer -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface
$passChange.SetBIOSSetting('Setup Password','<utf-16/>MYNEWPASSWORD','<utf-16/>')
}

Now, the following happen:

  1. If my BIOS has no password, the script works just fine!
  2. If my BIOS has password already, script has Return: 6. I suppose there is a different option for changing the BIOS password?If yes, any help is appreciated!
  3. If i run the script for my computer, it works.
  4. If i run the script for another computer i get the following error:

    The RPC server is unavailable. (Exception from HRESULT: 0x800706BA).

    Is there a way to enable an option to enable the RPC for this feature and then disable it again?

Thank you in advance

powershell
bios
asked on Stack Overflow Feb 27, 2018 by Spiris

1 Answer

0

According to HP's documentation HP Client Management Interface the WMI interface supports remote interfacing.

You need to ensure all remote computers you're attempting to connect to have the HP custom WMI Namespace.

You also need to ensure the account you're running under has administrative permissions on all of the remote computers.

You may also need to explicitly set the impersonation to 3 which is impersonate.

For more information: Connecting to WMI Remotely with PowerShell

Also ensure the firewall on the remote computers is either off or has exclusions for WMI

answered on Stack Overflow Feb 27, 2018 by Kriss Milne

User contributions licensed under CC BY-SA 3.0