Skip to content

Instantly share code, notes, and snippets.

@adam-nielsen
Last active January 7, 2019 22:20
Show Gist options
  • Select an option

  • Save adam-nielsen/3015619 to your computer and use it in GitHub Desktop.

Select an option

Save adam-nielsen/3015619 to your computer and use it in GitHub Desktop.

Revisions

  1. adam-nielsen revised this gist Apr 12, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion get-dell-warranty.sh
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    # It doesn't parse the WSDL or anything nice like that, it just sends a precomposed
    # request to the server and extracts the relevant info from the response.

    if [ "$1" == "" ]; then
    if [ -z "$1" ]; then
    echo 'Use: ./get-dell-warranty.sh <servicetag>'
    exit 1
    fi
  2. adam-nielsen created this gist Jun 29, 2012.
    34 changes: 34 additions & 0 deletions get-dell-warranty.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    #!/bin/sh

    # Warranty request script for Dell PCs
    # Written by Adam Nielsen <adam.nielsen@uq.edu.au>
    # This code is in the public domain, and is supplied with no warranty.
    #
    # This script uses Dell's web service to retrieve the most distant warranty expiration
    # date for a given machine, as identified by its service tag. It requires curl and awk.
    # It doesn't parse the WSDL or anything nice like that, it just sends a precomposed
    # request to the server and extracts the relevant info from the response.

    if [ "$1" == "" ]; then
    echo 'Use: ./get-dell-warranty.sh <servicetag>'
    exit 1
    fi

    curl http://xserv.dell.com/services/assetservice.asmx \
    -s -S --data-binary @- --header "Expect:" \
    --header "Soapaction: \"http://support.dell.com/WebServices/GetAssetInformation\"" \
    --header "Content-Type: text/xml; charset=utf-8" \
    << EOF | awk -F"</?EndDate>" '{for(i=1;++i<=NF;) if(length($i)==19) print substr($i, 1, 10)}' | sort -nr | head -n 1
    <?xml version="1.0" encoding="utf-8" ?>
    <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
    <n1:GetAssetInformation xmlns:n1="http://support.dell.com/WebServices/">
    <n1:guid>11111111-1111-1111-1111-111111111111</n1:guid>
    <n1:applicationName>get-dell-warranty.sh</n1:applicationName>
    <n1:serviceTags>$1</n1:serviceTags>
    </n1:GetAssetInformation>
    </env:Body>
    </env:Envelope>
    EOF