#!/bin/sh
KMS=`( echo open "$1"
	sleep 5
        echo "$2\r"
	sleep 1
        echo "$3\r" 
	sleep 1
	echo "cscript C:\windows\system32\slmgr.vbs -dlv\r"
	sleep 5
	echo "exit\r"
) | telnet`

KMS=`echo "$KMS" | grep -i "Current" | awk {'print $3'} | tr '\r' ' '`

if [ $KMS -le 24 ]
then
	echo "The current count is $KMS. You might want to force activation on a few machines."
	exit 2
elif [ $KMS -gt 24 ]
then
	echo "The current count is $KMS. Go have another cup of coffee."
	exit 0
fi

