This script will determine that Entourage is running then it will collect the Exchange email address and it will populate the JSS Location. Only way to do this when Entourage is running. So I didn't want to freak out users by just running Apple Script as it will open up Entourage.
It could be useful for someone...
You can also use this script for Outlook too! Just replace where ever it says Entourage with Outlook.
Some parts of the script has been inspired from William Smith, Thomas Larkin and Thorsten Hesse's ideas and from their scripts they have posted in this mailing list.
#!/bin/bash
# Lets check the Entourage is running
if [[ `ps -ax | grep -v grep | grep -c 'Microsoft Entourage'` == 1 ]] #if it was successful
then /bin/echo "Entourage is running, continuing as planned..."
else /bin/echo "Entourage is NOT running, we need to halt"
exit 55
fi
###Read email fields into variables.
EMAIL=`osascript -e 'tell application "Microsoft Entourage" to get email address of Exchange account 1'`
###Reset variables to remove white space.
EMAIL=`echo $EMAIL`
echo $EMAIL
###Run Recon and insert values in Location fields.
/usr/sbin/jamf recon -email "$EMAIL"