cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sseal
Engaged Sweeper III
It would be great if you could update LanSweeper to correctly pull the product info for HP computers. I have attached the scripts needed to do this. Also once you have this info it would be easy to add a custom action to link to warranty info and drivers.

Here is the correct vbscript to pull the HP Part Number and Serial Number:
Dim objWMI : Set objWMI = GetObject("winmgmts:")
Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem")
Dim colSettingsBios : Set colSettingsBios = objWMI.ExecQuery("Select * from Win32_BIOS")
Dim objComputer, strModel, strSerial
For Each objComputer in colSettings
strModel = objComputer.Model
Next
For Each objComputer in colSettingsBios
strSerial = objComputer.SerialNumber
Next
myarray = Split(strModel, "(")
wscript.echo "Model: ", Replace(myarray(0),"(","")
wscript.echo "Part Number:", Replace(myarray(1),")","")
wscript.echo "Serial: ", strSerial




and here is the Link for warranty info (replace {PARTNMUBER} & {SERIALNUMBER} with correct values:
http://h20000.www2.hp.com/bizsupport/TechSupport/WarrantyResults.jsp?nickname=&sn={SERIALNUMBER}&country=CA&lang=en&cc=us&pn={PARTNUMBER}&find=Display%20Warranty%20Information%20%C2%BB&


and here is the Link for drivers (replace {PARTNMUBER} with correct value:

http://h10025.www1.hp.com/ewfrf/wc/swPfinder?query={PARTNUMBER}&tool=softwareCategory&lc=en&cc=us&dlc=en
10 REPLIES 10
sseal
Engaged Sweeper III
So I went ahead and made it into a pair of custom actions, this is very rough and because of how HP stores it part numbers it only works on certain lines of their product. All of the business laptops work but only some of the desktop models.

Here is what you need to do:

(sorry for the code boxes but I can't attach files yet)

Step1. Create a file named HPwarranty.vbs that contains this:
ComputerName = Wscript.Arguments(0)

winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""
Set colSettings = GetObject( winmgmt1 ).InstancesOf ("Win32_ComputerSystem")
Set colSettingsBios = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")

For Each objComputer in colSettings
strModel = objComputer.Model
Next
For Each objComputer in colSettingsBios
strSerial = objComputer.SerialNumber
Next
if instr(strModel, "dc") > 0 then
msgbox "HP partnumber not found!"
else if instr(strModel, "HP") > 0 then
myarray = Split(strModel, "(")
wscript.echo "Model Number: ", Replace(myarray(0),"(","")
wscript.echo "Part Number: ", Replace(myarray(1),")","")
wscript.echo "Serial Number:", strSerial
s=Replace(myarray(1),")","")
sEncoded=Escape(s)
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("iexplore.exe http://h20000.www2.hp.com/bizsupport/TechSupport/WarrantyResults.jsp?nickname=&sn="& strSerial &"&country=CA&lang=en&cc=us&pn="& sEncoded &"&find=Display%20Warranty%20Information%20%C2%BB&", 1)
else msgbox "HP partnumber not found!"
end if
end if


Step2. Create a file named HPdrivers.vbs that contains this:
ComputerName = Wscript.Arguments(0)

winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""
Set colSettings = GetObject( winmgmt1 ).InstancesOf ("Win32_ComputerSystem")
Set colSettingsBios = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")

For Each objComputer in colSettings
strModel = objComputer.Model
Next
For Each objComputer in colSettingsBios
strSerial = objComputer.SerialNumber
Next
if instr(strModel, "dc") > 0 then
msgbox "HP partnumber not found!"
else if instr(strModel, "HP") > 0 then
myarray = Split(strModel, "(")
wscript.echo "Model Number: ", Replace(myarray(0),"(","")
wscript.echo "Part Number: ", Replace(myarray(1),")","")
wscript.echo "Serial Number:", strSerial
Set WshShell = WScript.CreateObject("WScript.Shell")
s=Replace(myarray(0),"(","")
sEncoded=Escape(s)
Return = WshShell.Run("iexplore.exe http://h10025.www1.hp.com/ewfrf/wc/swPfinder?query="& sEncoded &"&tool=softwareCategory&lc=en&cc=us&dlc=en", 1)
else msgbox "HP partnumber not found!"
end if
end if


step3. Create the following custom actions:
cscript.exe \\SERVER\lstools$\HPdrivers.vbs {computer}

cscript.exe \\SERVER\lstools$\HPwarranty.vbs {computer}


step4. Click and enjoy.

Please take these and use them, if you improve them I would love you to share!

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now