Hello,
We have about 3.500 HP workstations. We have 6 different models: HP Compaq 8000/8100/8200/8300 Elite, HP Compaq 6005 Pro and HP ProDesk 600 G1. As it turns out some of the workstations have the wrong boot order. Boot order must be: 1 - Network, 2 Hard Drive and some workstations have 1 - Hard Drive , 2 - Network. I want to correct this with PowerShell. I'm trying to read and set the Boot Order in the BIOS in Windows 8.1 Enterprise. These workstations are not up to date (Update 1 not installed) and we want to give all those 3.500 workstation a new ZENwork Windows 8.1 Update 1 image in Juli but the first boot must be Network otherwise it won't work. The next weeks we want to correct this boot order in the login script.
I don't want to use the BiosConfigUtility64.exe, well I have to use this if this PowerShell code does not work. This is the code I have so far:
#The correct settings string for each HP Model
#HP Compaq 8000/8100 Elite:
$strBootSetting1="Network Controller,Hard Drive,USB device,ATAPI CD-ROM Drive Disabled,Diskette Drive,PnP Device #2,PnP Device #3,PnP Device #4,PnP Device #5,PnP Device #6,PnP Device #7,PnP Device #8,PnP Device #9,PnP Device #10"
#HP Compaq 6005 Pro
$strBootSetting2="Network Controller,Hard Drive,USB device,ATAPI CD-ROM Drive Disabled,Diskette Drive,PnP Device #2,PnP Device #3,PnP Device #4,PnP Device #5,PnP Device #6,PnP Device #7,PnP Device #8,PnP Device #9,PnP Device #10,PnP Device #11"
#HP Compaq 8200 Elite / HP Compaq Elite 8300 / HP ProDesk 600 G1
$strBootSetting3="Network Controller,Hard Drive,USB Floppy/CD,ATAPI CD-ROM Drive,PnP Device #1,PnP Device #2,PnP Device #3,PnP Device #4,PnP Device #5,PnP Device #6,PnP Device #7,PnP Device #8,PnP Device #9,PnP Device #10,PnP Device #11"
#HP Models we have
$strModelHP8000="HP Compaq 8000 Elite"
$strModelHP6005="HP Compaq 6005 Pro"
$strModelHP8100="HP Compaq 8100 Elite"
$strModelHP8200="HP Compaq 8200 Elite"
$strModelHP8300="HP Compaq Elite 8300"
$strModelHP600G="HP ProDesk 600 G1"
$strBootOrder=""
$strModel=$(Get-WmiObject Win32_ComputerSystem).Model
#Not every model has the same BIOS setting name. It is "Boot Order" or "Legacy Boot Order"
if ($strModel.SubString( 0, 18) -eq $strModelHP6005 ) {
echo "Yes: $strModelHP6005"
$strBootOrder="Boot Order"
$strBootSetting=$strBootSetting2
}
elseif ($strModel.SubString( 0, 20) -eq $strModelHP8000 ) {
echo "Yes: $strModelHP8000"
$strBootOrder="Boot Order"
$strBootSetting=$strBootSetting1
}
elseif ($strModel.SubString( 0, 20) -eq $strModelHP8100 ) {
echo "Yes: $strModelHP8100"
$strBootOrder="Boot Order"
$strBootSetting=$strBootSetting1
}
elseif ($strModel.SubString( 0, 20) -eq $strModelHP8200 ) {
echo "Yes: $strModelHP8200"
$strBootOrder="Legacy Boot Order"
$strBootSetting=$strBootSetting3
}
elseif ($strModel.SubString( 0, 20) -eq $strModelHP8300 ) {
echo "Yes: $strModelHP8300"
$strBootOrder="Legacy Boot Order"
$strBootSetting=$strBootSetting3
}
elseif ($strModel.SubString( 0, 17) -eq $strModelHP600G ) {
echo "Yes: $strModelHP600G"
$strBootOrder="Legacy Boot Order"
$strBootSetting=$strBootSetting3
}
$objWMI = Get-WmiObject -class HP_BIOSSetting -Namespace "root\HP\InstrumentedBIOS" | Where Name -eq "$strBootOrder"
$strBootOrderValue=$objWMI.GetPropertyValue( "Value" )
if ( -not ($strBootOrderValue.SubString( 0, 29) -eq "Network Controller,Hard Drive" ) ) {
$objWMI.SetBIOSSetting( "$strBootOrder", "$strBootSetting", "<utf-16/>PASSWORD" )
}
Everywhere on internet I see the .SetBIOSSetting function but on our HP systems I get the error message "Method invocation failed because [System.Management.ManagmentObject] does not contain a method named 'SetBIOSSetting'."
$objWMI.SetPropertyValue( $strBootOrder, $strBootSetting ) does work. When you give the command$objWMI.GetPropertyValue( "Value" ) we get the value we just set with SetPropertyValue. The problem is that is does not get saved back to the BIOS.
What can I do to solve this or must I use the BiosConfigUtility64.exe tools? why do I not have the SetBIOSSetting option?
Best regards,
Diederick Cools