WinBatch® Technical Support Forum

All Things WinBatch => Customer Service => Topic started by: naholt on December 22, 2014, 12:00:01 PM

Title: SetBiosSetting
Post by: naholt 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
Title: Re: SetBiosSetting
Post by: td on December 22, 2014, 12:50:25 PM
'SetBiosSetting' is a method so it needs its parameter surrounded by parentheses.

Code (winbatch) Select

objItem.SetBiosSetting( "Asset Tracking Number", strValue ,"<kbd/>")
Title: Re: SetBiosSetting
Post by: naholt 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
Title: Re: SetBiosSetting
Post by: td 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 (http://h30499.www3.hp.com/t5/Business-PCs-Compaq-Elite-Pro/How-to-set-HP-BIOS-settings-from-Windows-XP/td-p/4153419)