SetBiosSetting

Started by naholt, December 22, 2014, 12:00:01 PM

Previous topic - Next topic

naholt

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

'SetBiosSetting' is a method so it needs its parameter surrounded by parentheses.

Code (winbatch) Select

objItem.SetBiosSetting( "Asset Tracking Number", strValue ,"<kbd/>")
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

naholt

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

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
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade