Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Dell/HP Warranty info

Created: 23 Oct 2012 | 3 comments

I have been looking into ways to pull the warranty information for my computers into altiris for reporting.  I have read this article:

https://www-secure.symantec.com/connect/forums/check-dell-warranty-script-error

and have been able to get my windows 7 PCs to run the script and get the warranty info into the database.  I have noticed that this script will not run on any of my XP machines.  I was also wondering if anyone has pulled in info for HP computers.

I will try to get the script for my XP machines working.  If I get it to work I will post my results.

Comments 3 CommentsJump to latest comment

JAunmc's picture

I think I have this working now for XP and win7.  changed the code a bit but I have only tested it on a few PCs but it seems to work.  Code follows:

Revised code below:

Dim SoapRequest
Dim url, regkey, svctag
Dim warrantyRows, warrantyCols
Dim objShell, objXML, objWMI, objHTTP, NodeList
Dim i, result
Dim strsld,strprv,strent,strstd,strend,strdl
Dim test, objItem, query_result, strComputer, wmi
'Create instance of Altiris NSE component
strComputer = "."
dim nse
set nse = WScript.CreateObject ("Altiris.AeXNSEvent")
'Set the header data of the NSE
'Don't modify this GUID
nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
nse.Priority = 1

'Create Inventory data block using the GUID of the custom inventory data class created on the NS
dim objDCInstance
set objDCInstance = nse.AddDataClass ("{cb45ea93-7786-4e63-8d0d-22b7cc093639}")
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)
SoapRequest = "<?xml version=""1.0"" encoding=""utf-8""?> <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""> <soap:Body> <GetAssetInformation xmlns=""http://support.dell.com/WebServices/""> <guid>11111111-1111-1111-1111-111111111111</guid> <applicationName>AssetService</applicationName> <serviceTags>!SERVICETAG!</serviceTags> </GetAssetInformation> </soap:Body></soap:Envelope>"

url = "http://xserv.dell.com/services/AssetService.asmx"
Set objShell = WScript.CreateObject("WScript.Shell")

strComputer = "."
Set wmi = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set query_result = wmi.ExecQuery("SELECT SerialNumber FROM Win32_BIOS")
For Each item In query_result
svctag = item.SerialNumber
'WScript.Echo item.SerialNumber
WScript.Echo svctag
Next

SoapRequest = Replace(SoapRequest, "!SERVICETAG!", svctag)
Set objHTTP = CreateObject("Msxml2.XMLHTTP")
objHTTP.open "POST", URL, false
objHTTP.setRequestHeader "Content-Type", "text/xml"
objHTTP.setRequestHeader "SOAPAction", "http://support.dell.com/WebServices/GetAssetInformation"
objHTTP.send SoapRequest
result = objHTTP.responseText
Set objXML = CreateObject ("Msxml2.DOMDocument")
objXML.LoadXml result
If not objXML.SelectSinglenode ("//faultstring") is nothing then
Err.Raise 1, "Error:" & objXML.SelectSingleNode("//faultcode").text, Trim(objXML.SelectSingleNode("//faultstring").text)
End If

Set NodeList = objXML.SelectNodes("//Asset/Entitlements/EntitlementData")
wscript.echo NodeList.length & " results returned: "

For i = 0 to NodeList.length - 1
set warrantyCols = NodeList.item(i)
strsld = warrantyCols.SelectSingleNode("ServiceLevelDescription").text
WScript.echo "ServiceLevelDescription: " & strsld
strprv = warrantyCols.SelectSingleNode("Provider").text
WScript.echo "Provider: " & strprv
strent = warrantyCols.SelectSingleNode("EntitlementType").text
WScript.echo "EntitlementType: " & strent
strstd = warrantyCols.SelectSingleNode("StartDate").text
WScript.echo "Start Date: " & strstd

strend = warrantyCols.SelectSingleNode("EndDate").text
WScript.echo "End Date: " & strend

'strdl = warrantyCols.SelectSingleNode("DaysLeft").text
'WScript.echo "Days Left: " & strdl

'Populate nse data fields
dim objDataRow
set objDataRow = objDataClass.AddRow
objDataRow.SetField 0, strsld
objDataRow.SetField 1, strprv
objDataRow.SetField 2, strent
objDataRow.SetField 3, strstd
objDataRow.SetField 4, strend
'objDataRow.SetField 5, strdl

'if IsNull(strEndDateValue) then
' objDataRow.SetField 2, "0"
'else
' objDataRow.SetField 2, strEndDateValue
'end if
'
'if IsNull(strEntitlementTypeValue) then
' objDataRow.SetField 3, "0"
'else
' objDataRow.SetField 3, strEntitlementTypeValue
'end if
'
'if IsNull(strProviderValue) then
' objDataRow.SetField 3, "0"
'else
' objDataRow.SetField 3, strProviderValue
'end if'
'
'if IsNull(strStartDateValue) then

' objDataRow.SetField 3, "0"
'else
' objDataRow.SetField 3, strStartDateValue
'end if
Next
'Send nse to altiris server
nse.SendQueued
 

KSchroeder's picture

Nice work...does anyone know if Lenovo has a similar web service? I would probably bulk-load these from asset management, maybe through an automation policy. Also might want to stagger the timing on this so Dell didn't detect a DOS and block you....if that fits up for all 22k machines at my work at once...:-)

Thanks,
Kyle
Symantec Trusted Advisor

For Forum threads, please click "Mark as Solution" if answered.
For all content, please give a thumbs up if you agree with or support the post.