Video Screencast Help

Check Dell Warranty Script - Error

Created: 30 Aug 2012 • Updated: 16 Sep 2012 | 6 comments
This issue has been solved. See solution.

Hi I am using the following script as provided in the "Extending CMS with HW Mgmt of Dell Business Client Devices.pdf"

If I run the script the full script it displays a box with serial number, then 5 results returned. Then errors at line 54 with Error Object required: SelectSinglenode - strsld = warrantyCols.SelectSingleNode("ServiceLevelDescription").text

Any ideas as I'm not really a scripting person so understand the process but not the language


Get Dell Warranty

' GetDellWarranty.vbs
' This script will query WMI for the service tag of a Dell Machine, query Dell using a SOAP request
' to obtain warranty information, and return the information to the SMP using an NSE
Option Explicit
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
'Create instance of Altiris NSE component

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 ("{5504c837-0a69-4274-8b54-bf8985fd1369}")
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)
SoapRequest = "<?xml version=""1.0"" encoding=""utf-8""?> <soap:Envelope xmlns:xsi="""" xmlns:xsd="""" xmlns:soap=""""> <soap:Body> <GetAssetInformation xmlns=""""> <guid>11111111-1111-1111-1111-111111111111</guid> <applicationName>AssetService</applicationName> <serviceTags>!SERVICETAG!</serviceTags> </GetAssetInformation> </soap:Body></soap:Envelope>"

url = ""
Set objShell = WScript.CreateObject("WScript.Shell")
set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
If InStr(UCase(objWMI.ExecQuery("Select Manufacturer From Win32_ComputerSystem").ItemIndex(0).Manufacturer), "DELL") = 0 then Err.Raise 2, "This is not a Dell computer and is not eligible for Dell Warranty lookup", "No Service Tag"
svctag = Trim(objWMI.ExecQuery ("Select SerialNumber from Win32_BIOS").ItemIndex(0).SerialNumber)

wscript.echo "Service Tag: " & svctag
SoapRequest = Replace(SoapRequest, "!SERVICETAG!", svctag)
Set objHTTP = CreateObject("Msxml2.XMLHTTP") "POST", URL, false
objHTTP.setRequestHeader "Content-Type", "text/xml"
objHTTP.setRequestHeader "SOAPAction", ""
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"
' objDataRow.SetField 2, strEndDateValue
'end if
'if IsNull(strEntitlementTypeValue) then
' objDataRow.SetField 3, "0"
' objDataRow.SetField 3, strEntitlementTypeValue
'end if
'if IsNull(strProviderValue) then
' objDataRow.SetField 3, "0"
' objDataRow.SetField 3, strProviderValue
'end if'
'if IsNull(strStartDateValue) then

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

Comments 6 CommentsJump to latest comment

gman1981's picture

Hi, I've had teh same problem, I worked out that Dell are not returning that field anymore so you need to comment out the two lines as below:

'strsld = warrantyCols.SelectSingleNode("ServiceLevelDescription").text
'WScript.echo "ServiceLevelDescription: " & strsld

David Griffiths
Technical Support Manager
Toyota (GB)

cathossie's picture

Hi David

How do I distingiush what is the pc's actual warranty ie: our pro support end date other than guessing it would be latest date. Is there a field name that would distinguish this So I can report on only it rather than the 5 different dates.?


Triplex's picture

ServiceLevelDescription and Provider are empty

does someone have a Solution ?

strsld = warrantyCols.SelectSingleNode("ServiceLevelDescription").text
WScript.echo "ServiceLevelDescription: " & strsld

strprv = warrantyCols.SelectSingleNode("Provider").text
WScript.echo "Provider: " & strprv

EntitlementType: Active
Start Date: 2012-08-03T00:00:00
End Date: 2013-08-04T00:00:00
Days Left: 328

cathossie's picture

Powershell Script that Writes the maiximum date for warranty end to a registry key.

Acknowledgements go to Patrick whom I work with for writing this, now to do get the inventory query with powershell correct instead of using VB.


[String]$ServiceTag = $(Get-WmiObject -Class "Win32_Bios").SerialNumber
$AssetService = New-WebServiceProxy -Uri "";
$ApplicationName = "AssetService";
$Guid = [Guid]::NewGuid();
$Asset = $AssetService.GetAssetInformation($Guid,$ApplicationName,$ServiceTag);
$Writer = New-Object "System.IO.StringWriter";
$XmlSerializer = New-Object System.Xml.Serialization.XmlSerializer($Asset.GetType());
[String]$Result = $Writer.ToString();

[xml]$dellinfo = $Result
# [System.Windows.Forms.MessageBox]::Show($dellinfo)
# Get-DellAssetInformation | Out-File C:\temp\dell.txt

foreach ($set in $dellinfo.ArrayOfAsset.Asset.Entitlements.EntitlementData)
    [DateTime]$date = Get-Date $set.EndDate
    if ($date -gt $maxdate)
            $maxdate = $date

#[System.Windows.Forms.MessageBox]::Show($maxdate.ToShortDateString(), "maximum")

if (Test-Path 'HKLM:\Software\DellWarranty' -erroraction silentlycontinue) {
    #"Registry key HKLM:\Software\DellWarranty already exists."
} else {
    md HKLM:\Software\DellWarranty

if (Get-ItemProperty -Name "WarrantyExpiry" -path 'HKLM:\Software\DellWarranty' -erroraction silentlycontinue) {
    #"Registry key HKLM:\Software\DellWarranty\WarrantyExpiry already exists."
} else {
    New-ItemProperty "HKLM:\Software\DellWarranty" -Name "WarrantyExpiry" -Value $maxdate.toshortdatestring() -PropertyType "String"

#Function Get-DellAssetInformation{
#Param([String]$ServiceTag = $(Get-WmiObject -Class "Win32_Bios").SerialNumber);
#    Try{
#    $AssetService = New-WebServiceProxy -Uri "";
#    $ApplicationName = "AssetService";
#    $Guid = [Guid]::NewGuid();
#   $Asset = $AssetService.GetAssetInformation($Guid,$ApplicationName,$ServiceTag);
#    $Writer = New-Object "System.IO.StringWriter";
#    $XmlSerializer = New-Object System.Xml.Serialization.XmlSerializer($Asset.GetType());
#    $XmlSerializer.Serialize($Writer,$Asset);
#    [String]$Result = $Writer.ToString();
#    $Writer.Flush();
#    $Writer.Close();
#    Return $Result;
#    }
#    Catch{
#    Write-Host $($_.Exception.Message);    
#    }

JAunmc's picture

How do you run this powershell script from altiris?  And then how do you get it into the inventory??  I'm a little new at this and was asked for this information.

cathossie's picture

I have to revisit this personally but have got involved in other projects recently. At the moment I run this as a task from the NS7.1 and I'm not posting the info back to the inventory. It does generate a registry key on the client, we want a record of the warranty on the client and will use the BGinfo or similar so a client can check the warranty details.

To post to the NS I am going to use a vbscript to post the registry details back to the NS - I haven't worked on this yet but I will be editing the old Dell warranty VBS to look for a registry key unless I find an example on the web.

I would love a powershell script if anyone has one to use for inventory data instead of VBS.