Client Management Suite

 View Only
  • 1.  Check Dell Warranty Script - Error

    Posted Aug 30, 2012 03:05 AM

    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

    FULL SCRIPT

    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=""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")
    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")
    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



  • 2.  RE: Check Dell Warranty Script - Error

    Posted Sep 05, 2012 06:57 AM

    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

     

     



  • 3.  RE: Check Dell Warranty Script - Error

    Posted Sep 09, 2012 08:50 PM

    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.?

    Catherine



  • 4.  RE: Check Dell Warranty Script - Error

    Posted Sep 10, 2012 07:54 AM

    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

     

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



  • 5.  RE: Check Dell Warranty Script - Error
    Best Answer

    Posted Sep 17, 2012 02:33 AM

    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.

    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

    [String]$ServiceTag = $(Get-WmiObject -Class "Win32_Bios").SerialNumber
    $AssetService = New-WebServiceProxy -Uri "http://xserv.dell.com/services/AssetService.asmx?WSDL";
    $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();

    [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)
    {
        #[System.Windows.Forms.MessageBox]::Show($set)
        [DateTime]$date = Get-Date $set.EndDate
        #[System.Windows.Forms.MessageBox]::Show($date.ToShortDateString())
       
        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 "http://xserv.dell.com/services/AssetService.asmx?WSDL";
    #    $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);    
    #    }
    #}



  • 6.  RE: Check Dell Warranty Script - Error

    Posted Oct 16, 2012 03:37 PM

    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.



  • 7.  RE: Check Dell Warranty Script - Error

    Posted Oct 16, 2012 10:23 PM

    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.

    Catherine