Author Topic: SetBiosSetting  (Read 2481 times)

naholt

  • Newbie
  • *
  • Posts: 14
SetBiosSetting
« on: December 22, 2014, 12:00:01 pm »
I am trying to convert a vbs to winbatch script for setting the asset tag. the vbs works fine but in winbatch I am having issues with "SetBiosSetting" here is my winbatch file:

strvalue = "asset tag"
  objwmiServices  = ObjectGet ( "winmgmts:{impersonationLevel=Impersonate}!//./root/HP/InstrumentedBIOS")
  colItems =  objwmiServices.ExecQuery ( "SELECT * from HP_BIOSSettingInterface",,48)

 ForEach objItem in colItems
  objItem.SetBiosSetting "Asset Tracking Number", strValue ,"<kbd/>"
  if oReturn then
   wscript.echo "Asset Tracking Number" & " Can not be set, Error="  & ErrCode(oReturn)
   wscript.quit(oReturn )
  end if
 Next

the line I am having the issue is:   objItem.SetBiosSetting "Asset Tracking Number", strValue ,"<kbd/>".  I am not sure to make it work
thanks
Nicholas

td

  • Tech Support
  • *****
  • Posts: 2024
    • WinBatch
Re: SetBiosSetting
« Reply #1 on: December 22, 2014, 12:50:25 pm »
'SetBiosSetting' is a method so it needs its parameter surrounded by parentheses.

Code: Winbatch
objItem.SetBiosSetting( "Asset Tracking Number", strValue ,"<kbd/>")
 
"DON'T PANIC”
The Hitchhiker's Guide to the Galaxy, Douglas Adams


naholt

  • Newbie
  • *
  • Posts: 14
Re: SetBiosSetting
« Reply #2 on: January 05, 2015, 06:52:23 am »
I tried that but it does not set the asset tag in the bios. here is the complete script:

strvalue = "asset tag"
  objwmiServices  = ObjectGet ( "winmgmts:{impersonationLevel=Impersonate}!//./root/HP/InstrumentedBIOS")
  colItems =  objwmiServices.ExecQuery ( "SELECT * from HP_BIOSSettingInterface",,48)

 ForEach objItem in colItems
objItem.SetBiosSetting("Asset Tracking Number", strValue, "<kbd/>")
 Next
 
can you please tell me what I am doing wrong?

thanks
Nicholas

td

  • Tech Support
  • *****
  • Posts: 2024
    • WinBatch
Re: SetBiosSetting
« Reply #3 on: January 05, 2015, 08:46:06 am »
You are likely not providing the method with the correct parameters and this is more an HP question than a WinBatch question.  A search using your search engine of choice should provide you with information about required method parameters.  Here is a link to one of many found with a Google search on the method's name:

http://h30499.www3.hp.com/t5/Business-PCs-Compaq-Elite-Pro/How-to-set-HP-BIOS-settings-from-Windows-XP/td-p/4153419
"DON'T PANIC”
The Hitchhiker's Guide to the Galaxy, Douglas Adams