How To: Check Apple Warranty Status via ARD
Here is an awesome little script by Scott Russell of the University of Notre Dame. Using the “send Unix command” in Apple Remote Desktop, it can pull the system’s serial number, send the information to Apple’s Warranty Website and then tell you if the machine is under warranty.
#!/bin/bash
# warranty.sh
# Description: looks up Apple warranty info for this computer, or one
specified by serial number on the command-line
# Written by: Scott Russell, IT Support Engineer, University of Notre
Dame
# Created on: Sat Jan 5 16:20:54 EST 2008
# Last Modified: Thu Sep 25 09:29:11 EDT 2008
###############
## GLOBALS ##
###############
WarrantyTempFile="/tmp/warranty.txt"
PlistFile="/Library/Preferences/edu.ND.DSSBranding"
if [[ $# == 0 ]] ; then
SerialNumber=`system_profiler SPHardwareDataType | grep "Serial Number"
| awk -F': ' {'print $2'} 2>/dev/null`
else
SerialNumber="${1}"
fi
[[ -n "${SerialNumber}" ]] && WarrantyInfo=`curl -k -s
"https://selfsolve.apple.com/Warranty.do?serialNumber=${SerialNumber}&countr
y=USA&fullCountryName=United%20States" | awk '{gsub(/","/,"n");print}' |
awk '{gsub(/":"/,":");print}' > ${WarrantyTempFile}`
#################
## FUNCTIONS ##
#################
GetWarrantyValue()
{
grep -w "${1}" ${WarrantyTempFile} | awk -F ':' {'print $2'}
}
###################
## APPLICATION ##
###################
echo "$(date) ... Checking warranty status"
InvalidSerial=`grep "serial number provided is invalid"
"${WarrantyTempFile}"`
#echo "InvalidSerial == ${InvalidSerial}"
if [[ -e "${WarrantyTempFile}" && -z "${InvalidSerial}" ]] ; then
echo " Serial Number == ${SerialNumber}"
PurchaseDate=`GetWarrantyValue PURCHASE_DATE`
echo " PurchaseDate == ${PurchaseDate}"
WarrantyExpires=`GetWarrantyValue COVERAGE_DATE`
echo " WarrantyExpires == ${WarrantyExpires}"
ProductDescription=`GetWarrantyValue PROD_DESCR`
echo " ProductDescription == ${ProductDescription}"
else
[[ -z "${SerialNumber}" ]] && echo " No serial number was found."
[[ -n "${InvalidSerial}" ]] && echo " Warranty information was
not found for ${SerialNumber}."
fi
exit 0