Wednesday, June 4, 2008

Office 2008 for Mac: reset the licence number

If for some reason you need to reset your Office 2008 for Mac license number, the simple script below is what you need. Just copy and paste it in your favorite text editor, save it as "reset_office_license.sh", open a terminal window, cd in the directory where you saved it, give it the execution permission (chmod +x reset_office_license.sh) and run it (./reset_office_license.sh). The script might need superuser permissions to run correctly.

#!/bin/bash
# Author: Massimiliano Marcon
# Description: this script resets the Microsoft Office 2008 for Mac licence number.

DEFAULT_OFFICE_PID_LOCATION="/Applications/Microsoft\ Office\ 2008/Office/OfficePID.plist"
DEFAULT_OFFICE_SETTING_LOCATION="~/Library/Preferences/Microsoft/Office\ 2008/"

function reset () {
mkdir /tmp/backup-office-licence
mv $DEFAULT_OFFICE_PID_LOCATION /tmp/backup-office-licence
mv $DEFAULT_OFFICE_SETTING_LOCATION/Microsoft\ Office\ 2008\ Settings.plist /tmp/backup-office-licence
mv $DEFAULT_OFFICE_SETTING_LOCATION/Office\ Registration\ Cache\ 2008 /tmp/backup-office-licence
echo "Done. Restart Microsoft Office and insert the new serial number."
}

function question () {
echo -n "Would you like to reset your Microsoft Office Licence Key now? (yes/no) "
read RESPONSE
case "$RESPONSE" in
yes)
#Reset process
reset
#End reset process
;;
no)
echo "Nothing to do, exiting."
;;
*)
echo "Please type \"yes\" or \"no\""
question
;;
esac
}

echo "[Resetting your Microsoft Office Licence Key...]"
echo "*** All the files will be moved in /tmp ***"

question

exit 0