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
'SetBiosSetting' is a method so it needs its parameter surrounded by parentheses.
objItem.SetBiosSetting( "Asset Tracking Number", strValue ,"<kbd/>")
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
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)