Skip to content

Instantly share code, notes, and snippets.

@KatelynHaworth
Created May 25, 2016 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KatelynHaworth/c65329beb6a793f43b0678395f889e44 to your computer and use it in GitHub Desktop.
Save KatelynHaworth/c65329beb6a793f43b0678395f889e44 to your computer and use it in GitHub Desktop.
A simple little tool for the CLI to lookup the model for a Dell system based on its service tag
#!/bin/bash
#
# A simple command line tool to
# look the system model for a Dell
# service tag
#
# Usage:
# getModelFromServiceTag SERVICE_TAG
#
# Author: Liam Haworth <liam.haworth@tesserent.com>
#
# Copyright (c) Tesserent Ltd, 2016.
#
if [ -z "${1}" ]; then
echo "Parameter 1 must be set!"
echo
echo "Usage:"
echo -e "\tgetModelFromServiceTag SERVICE_TAG"
echo
echo -e "\tSERVICE_TAG - The service tag for the system to get the model of"
echo
exit 1
fi
model=$(curl -sL http://www.dell.com/support/home/us/en/04/product-support/servicetag/${1} | grep -o "<h3 id=\"ProductName\" class=\"no-margin\">.*</h3>" | sed 's/\(<h3 id="ProductName" class="no-margin">\|<\/h3>\)//g')
if [ -z "${model}" ]; then
echo "Failed to get a model for the service tag: ${1}"
else
echo "Dell says that ${1} is a \"${model}\""
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment