Skip to main content

Grab Dell Warranty Date on Dell Devices

This script will grab the warranty end date based on a server’s/laptop’s/PC’s asset tag number and then, it will create a file on your C drive named warranty.txt
You can modify the behaviour as needed. Just create a new file and put the code in it, then rename it to warrantycheck.vbs.
This is usefull for massive checks on servers and workstation or Labtech automation

 

  1. Option Explicit
  2. Dim SoapRequest
  3. Dim url, regkey, svctag
  4. Dim warrantyRows, warrantyCols
  5. Dim objShell, objXML, objWMI, objHTTP, NodeList
  6. Dim i, result
  7. 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/JigsawWebServices/""> <guid>11111111-1111-1111-1111-111111111111</guid> <applicationName>Warranty Information Lookup</applicationName> <serviceTags>!SERVICETAG!</serviceTags> </GetAssetInformation> </soap:Body></soap:Envelope>"
  8. url = "http://xserv.dell.com/jigsawwebservices/AssetService.asmx"
  9. regkey = "HKEY_LOCAL_MACHINE\Software\DellWarrantyInfo"
  10. set objShell = WScript.CreateObject("WScript.Shell")
  11. set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
  12. If InStr(UCase(objWMI.ExecQuery("Select Manufacturer From Win32_ComputerSystem").ItemIndex(0).Manufacturer), "DELL") = 0 then Err.Raise 2, "This is not Dell malaka"
  13. svctag = Trim(objWMI.ExecQuery  ("Select SerialNumber from Win32_BIOS").ItemIndex(0).SerialNumber)
  14. SoapRequest = Replace(SoapRequest, "!SERVICETAG!", svctag)
  15. Set objHTTP = CreateObject("Msxml2.XMLHTTP")
  16. objHTTP.open "POST", URL, false
  17. objHTTP.setRequestHeader "Content-Type", "text/xml"
  18. objHTTP.setRequestHeader "SOAPAction", "http://support.dell.com/JigsawWebServices/GetAssetInformation"
  19. objHTTP.send SoapRequest
  20. result = objHTTP.responseText
  21. Set objXML = CreateObject ("Msxml2.DOMDocument")
  22. objXML.LoadXml result
  23. If not objXML.SelectSinglenode ("//faultstring") is nothing then
  24.     Err.Raise 1,  "Error:" & objXML.SelectSingleNode("//faultcode").text, Trim(objXML.SelectSingleNode("//faultstring").text)
  25. End If
  26. Set NodeList = objXML.SelectNodes("//Asset/Entitlements/EntitlementData")
  27. set warrantyCols = NodeList.item(0)
  28. dim filesys, filetxt, getname, path
  29. Set filesys = CreateObject("Scripting.FileSystemObject")
  30. Set filetxt = filesys.CreateTextFile("c:\warranty.txt", True)
  31. path = filesys.GetAbsolutePathName("c:\warranty.txt")
  32. getname = filesys.GetFileName(path)
  33. filetxt.WriteLine(Mid(warrantyCols.SelectSingleNode("EndDate").text,1,10) & " (" & svctag & ")")
  34. filetxt.Close

upggr

I am the one