none
Setup HP BIOS password using PowerShell Reading Names from file RRS feed

  • Question

  • Hi:  I found this very good script IN YOUR SITE called "SETUP BIOS PASSWORD USING POWERSHELL".  It looks like this

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

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

    How can I make it read a list of computer names from a text file?

    I tried the following but it failed

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

    Any help would be welcome.

    Wednesday, March 15, 2017 3:57 PM

Answers

  • Correction.

    $computers= Get-Content -Path c:\computers.txt
    Foreach ($computer in $computers) {

    $passChange= Get-WmiObject -computername $computer -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface
    $passChange
    .SetBIOSSetting('Setup Password', '<utf-16/> PasswordHere')
    }

    • Marked as answer by H..Aleman Thursday, March 16, 2017 1:27 AM
    Wednesday, March 15, 2017 5:37 PM

All replies