Friday, 23 May 2014

Customising office for mac using Bash

#!/bin/bash

# Post install script to customize office 14.4.1
#created by tausif for FICO

cuser=$(ls -l /dev/console | awk '{print $3}')
uhome=$(sudo dscl . -read /Users/$cuser NFSHomeDirectory | awk '{print $2}')
ugroup=$(id -g -n $cuser)

LOGF="/private/var/log/Office-Setup.log"


# Set the Office .plist paths and locations.
OFFICEPREF="$uhome/Library/Preferences/com.microsoft.office.plist"
OFFICEDOMAIN="$uhome/Library/Preferences/com.microsoft.office"

# Set the name of the Organisation
OFFICEORG="Fair Isaac Corporation"

# Auto Updates
AUPREF="$uhome/Library/Preferences/com.microsoft.autoupdate2.plist"
AUDOMAIN="$uhome/Library/Preferences/com.microsoft.autoupdate2"

# Error Reporting
ERPREF="$uhome/Library/Preferences/com.microsoft.error_reporting.plist"
ERDOMAIN="$uhome/Library/Preferences/com.microsoft.error_reporting"

# Excel
EXPREF="$uhome/Library/Preferences/com.microsoft.Excel.plist"
EXDOMAIN="$uhome/Library/Preferences/com.microsoft.Excel"

# Word
WORPREF="$uhome/Library/Preferences/com.microsoft.Word.plist"
WORDOMAIN="$uhome/Library/Preferences/com.microsoft.Word"

# PowerPoint
PPTPREF="$uhome/Library/Preferences/com.microsoft.PowerPoint.plist"
PPTDOMAIN="$uhome/Library/Preferences/com.microsoft.PowerPoint"

# Outlook
OUTPREF="$uhome/Library/Preferences/com.microsoft.Outlook.plist"
OUTDOMAIN="$uhome/Library/Preferences/com.microsoft.Outlook"

sleep 2
##################### Beginning ###############################################

echo "---------- Beginning Log ----------" >> "$LOGF"
echo "Configuring Office 2011............" >> "$LOGF"
echo `date "+%d%m%y %H.%M"` >> "$LOGF"
echo "User: $cuser" >> "$LOGF"

###############################################################################
# Remove Dock items early                                                               #
###############################################################################
i="$(defaults read $uhome/Library/Preferences/com.apple.dock.plist persistent-apps | grep _CFURLString\" | awk '/Microsoft%20Office%202011/ {print NR}')"
for  j in `echo "$i" | tr " " "\n" | sort -gr`
do
                /usr/libexec/PlistBuddy -c "Delete persistent-apps:$[$j-1]" $uhome/Library/Preferences/com.apple.dock.plist
done

killall -hup Dock

sleep 1


##################### Office Preferences #######################################

# Create files and values com.microsoft.office.plist
if [ -f "$OFFICEPREF" ];then
echo "com.microsoft.office.plist exists." >> "$LOGF"
else
echo "com.microsoft.office.plist does not exist. Creating it and setting SetupComplete to 1" >> $LOGF
defaults write "$OFFICEDOMAIN" "14\\FirstRun\\SetupComplete" -int 1
defaults write "$OFFICEDOMAIN" "14\\File New State\\FNXCEL" -int 0
defaults write "$OFFICEDOMAIN" "14\\File New State\\FNPPT3" -int 0
defaults write "$OFFICEDOMAIN" "14\\File New State\FNMSWD" -int 0
chown -R "$cuser":"$ugroup" "$OFFICEPREF"
chmod -f 777 "$OFFICEPREF"
fi

echo "Checking if 14\\FirstRun\\SetupComplete has value 1" >> "$LOGF"
SETUPSTATUS=$(defaults read "$OFFICEDOMAIN" "14\\FirstRun\\SetupComplete")
if [ $SETUPSTATUS = 1 ];then
echo "SetupComplete is set to 1. Nothing to do" >> "$LOGF"
else
echo "Setting SetupComplete to 1" >> "$LOGF"
defaults write "$OFFICEDOMAIN" "14\\FirstRun\\SetupComplete" -int 1
defaults write "$OFFICEDOMAIN" "14\\File New State\FNXCEL" -int 0
defaults write "$OFFICEDOMAIN" "14\\File New State\FNPPT3" -int 0
defaults write "$OFFICEDOMAIN" "14\\File New State\FNMSWD" -int 0
chown -R "$cuser":"$ugroup" "$OFFICEPREF"
chmod -f 777 "$OFFICEPREF"
fi



##################### Excel Preferences ######################################

# Disable Excel Welcome Screen
if [ -f "$EXPREF" ];then
echo "com.microsoft.Excel.plist exists." >> "$LOGF"
else
echo "com.microsoft.Excel.plist does not exist. Creating it and setting SetupComplete to 1" >> "$LOGF"
defaults write "$EXDOMAIN" "14\\Microsoft Excel\\Hide Welcome Window" -int 1
chown -R "$cuser":"$ugroup" "$EXPREF"
chmod -f 777 "$EXPREF"
fi

SETUPEXCELSTATUS=$(defaults read "$EXDOMAIN" "14\\Microsoft Excel\\Hide Welcome Window")
if [ $SETUPEXCELSTATUS = 1 ]
then
echo "Excel Welcome Window is set to 1. Nothing to do" >> "$LOGF"
else
echo "Setting Hide Welcome Window to 1" >> "$LOGF"
defaults write "$EXDOMAIN" "14\\Microsoft Excel\\Hide Welcome Window" -int 1
chown -R "$cuser":"$ugroup" "$EXPREF"
chmod -f 777 "$EXPREF"
fi

##################### Word Preferences ######################################

# Disable Word Welcome Screen
if [ -f "$WORPREF" ];then
echo "com.microsoft.Word.plist exists." >> "$LOGF"
else
echo "com.microsoft.Word.plist does not exist. Creating it and setting SetupComplete to 1" >> "$LOGF"
defaults write "$WORDOMAIN" "14\\Options\\Hide Welcome Dialog" -int 1
defaults write "$WORDOMAIN" "14\\Options\\Options:StartWhatIsNew" - int 1
chown -R "$cuser":"$ugroup" "$WORDPREF"
chmod -f 777 "$WORPREF"
fi

SETUPWORDSTATUS=$(defaults read "$WORDOMAIN" "14\\Options\\Hide Welcome Dialog")
if [ $SETUPWORDSTATUS = 1 ]
then
echo "Word Welcome Window is set to 1. Nothing to do" >> "$LOGF"
else
echo "Setting Hide Welcome Window to 1" >> "$LOGF"
defaults write "$WODOMAIN" "14\\Options\\Hide Welcome Dialog" -int 1
defaults write "$WORDOMAIN" "14\\Options\\Options:StartWhatIsNew" - int 1
chown -R "$cuser":"$ugroup" "$WORDPREF"
chmod -f 777 "$WORPREF"
fi

##################### PowerPoint Preferences ######################################

# Disable PowerPoint Welcome Screen
if [ -f "$PPTPREF" ]; then
echo "com.microsoft.PowerPoint.plist exists." >> "$LOGF"
else
echo "com.microsoft.PowerPoint.plist does not exist. Creating it and setting SetupComplete to 1" >> "$LOGF"
defaults write "$PPTDOMAIN" "14\\Options\\Options\\Hide Welcome Dialog" -int 1
chown -R "$cuser":"$ugroup" "$PPTPREF"
chmod -f 777 "$PPTPREF"
fi

SETUPPPTSTATUS=$(defaults read "$PPTDOMAIN" "14\\Options\\Options\\Hide Welcome Dialog")
if [ $SETUPPPTSTATUS = 1 ]
then
echo "PowerPoint Welcome Window is set to 1. Nothing to do" >> "$LOGF"
else
echo "Setting Hide Welcome Window to 1" >> "$LOGF"
defaults write "$PPTDOMAIN" "14\\Options\\Options\\Hide Welcome Dialog" -int 1
chown -R "$cuser":"$ugroup" "$PPTPREF"
chmod -f 777 "$PPTPREF"
fi


##################### Outlook Preferences ######################################

# Disable Outlook Welcome Screen
if [ -f "$OUTPREF" ];then
echo "com.microsoft.Outlook.plist exists." >> "$LOGF"
else
echo "com.microsoft.Outlook.plist does not exist. Creating it and setting SetupComplete to 1" >> "$LOGF"
defaults write "$OUTDOMAIN" "FirstRunExperienceCompleted" -int 1
chown -R "$cuser":"$ugroup" "$OUTPREF"
chmod -f 777 "$OUTPREF"
fi
SETUPOUTSTATUS=$(defaults read "$OUTDOMAIN" "FirstRunExperienceCompleted")
if [ $SETUPOUTSTATUS = 1 ]; then
echo "Outlook Welcome Window is set to 1. Nothing to do" >> "$LOGF"
else
echo "Setting Hide Welcome Window to 1" >> "$LOGF"
defaults write "$OUTDOMAIN" "FirstRunExperienceCompleted" -int 1
chown -R "$cuser":"$ugroup" "$OUTPREF"
chmod -f 777 "$OUTPREF"
fi

##################### Update Preferences ######################################

# Create fields and values com.microsoft.autoupdate2.plist
if [ -f "$AUPREF" ];then
echo "com.microsoft.autoupdate2.plist exists." >> "$LOGF"
else
echo "com.microsoft.autoupdate2.plist does not exist. Creating it and setting HowToCheck and LastUpdate to Manual" >> "$LOGF"
defaults write "$AUDOMAIN" "HowToCheck" -string "Manual" >> "$LOGF"
defaults write "$AUDOMAIN" "LastUpdate" -date "2001-01-01T00:00:00Z" >> "$LOGF"
chown -R "$cuser":"$ugroup" "$AUPREF"
chmod -f 777 "$AUPREF"
fi
echo "Checking if HowToCheck has value Manual" >> "$LOGF"
HOWTOCHECK=$(defaults read "$AUDOMAIN" "HowToCheck")
LASTUPDATE=$(defaults read "$AUDOMAIN" "LastUpdate")
if [ $HOWTOCHECK = "Automatic" ]
then
echo "HowToCheck is set to Automatic. Nothing to do" >> "$LOGF"
else
echo "Setting HowToCheck to Automatic" >> "$LOGF"
defaults write "$AUDOMAIN" "HowToCheck" -string "Automatic"
chown -R "$cuser":"$ugroup" "$AUPREF"
chmod -f 777 "$AUPREF"
fi
if [ -z "$LASTUPDATE" ];then
echo "LastUpdate is empty, populating"
defaults write "$AUDOMAIN" "LastUpdate" -date "2001-01-01T00:00:00Z"
chown -R "$cuser":"$ugroup" "$AUPREF"
chmod -f 777 "$AUPREF"
else
echo "LastUpdate exists" >> "$LOGF"
fi

##################### Error Reporting Preferences ######################################

# Create fields and values com.microsoft.error_reporting.plist
if [ -f "$ERPREF" ];then
echo "com.microsoft.error_reporting.plist exists." >> "$LOGF"
else
echo "com.microsoft.error_reporting.plist does not exist. Creating it and setting SQMReportsEnabled and ShipAssertEnabled to False" >> "$LOGF"
defaults write "$ERDOMAIN" "SQMReportsEnabled" -bool False
defaults write "$ERDOMAIN" "ShipAssertEnabled" -bool False
chown -R "$cuser":"$ugroup" "$ERPREF"
chmod -f 777 "$ERPREF"
fi
echo "Checking if SQMReportsEnabled has value False" >> "$LOGF"
SQMREPORTS=$(defaults read "$ERDOMAIN" "SQMReportsEnabled")
SHIPASSERT=$(defaults read "$ERDOMAIN" "ShipAssertEnabled")
if [ $SQMREPORTS = "0" ]
then
echo "SQMReportsEnabled is set to False. Nothing to do" >> "$LOGF"
else
echo "Setting SQMReportsEnabled to False" >> "$LOGF"
defaults write "$ERDOMAIN" "SQMReportsEnabled" -bool False
chown -R "$cuser":"$ugroup" "$ERPREF"
chmod -f 777 "$ERPREF"
fi
if [ $SHIPASSERT = "0" ]
then
echo "ShipAssertEnabled is set to False. Nothing to do" >> "$LOGF"
else
echo "Setting ShipAssertEnabled to False" >> "$LOGF"
defaults write "$ERDOMAIN" "ShipAssertEnabled" -bool False
chown -R "$cuser":"$ugroup" "$ERPREF"
chmod -f 777 "$ERPREF"
fi

##################### UserInfo Preferences ######################################

# Set name
REALNAME=$(dscl . -read /Users/$cuser RealName | grep -v RealName | sed 's/^[ ]*//')
echo "Setting realname" >> "$LOGF"
defaults write "$OFFICEDOMAIN" "14\\UserInfo\\UserName" -string "$REALNAME"
defaults write "$OFFICEDOMAIN" "14\\UserInfo\\UserOrganization" -string "$OFFICEORG"
chown -R "$cuser":"$ugroup" "$OFFICEPREF"
chmod -f 777 "$OFFICEPREF"


##################### Ending Preferences ######################################

echo -e "---------- Ending Log ----------\n" >> "$LOGF"

sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "tile-datafile-data_CFURLString/Applications/Microsoft Office 2011/Microsoft Word.app_CFURLStringType0"
sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "tile-datafile-data_CFURLString/Applications/Microsoft Office 2011/Microsoft Excel.app_CFURLStringType0"
sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "tile-datafile-data_CFURLString/Applications/Microsoft Office 2011/Microsoft PowerPoint.app_CFURLStringType0"
sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "tile-datafile-data_CFURLString/Applications/Microsoft Office 2011/Microsoft Outlook.app_CFURLStringType0"

sleep 3

chown "$cuser":"$ugroup" $HOME/Library/Preferences/com.apple.dock.plist
chmod 600 $HOME/Library/Preferences/com.apple.dock.plist

sudo jamf policy -trigger 2014OfficeTemplates -verbose >> "$LOGF"

sudo rm -f /usr/sbin/dockutil

killall cfprefsd
killall -hup Dock

exit 0

Monday, 19 May 2014

Office for mac removal script.



#!/bin/sh
## postflight
## Office for mac removal script by tausif


###############################################################################
# Set variables #
###############################################################################
HOME=$(sudo dscl . -read /Users/$USERNAME NFSHomeDirectory | awk '{print $2}')
#get actual home directory on mac
person=$( ls -l /dev/console | awk '{print $3}' )
#get logged in user
sudo touch "/private/var/log/office_install.log"
logFile="/private/var/log/office_install.log"
log () {
echo $1
echo $(date "+%Y-%m-%d %H:%M:%S: ") $1 >> $logFile
}

if ! (which -s dockutil && dockutil --version | grep -q '^1.1.4$';); then
cd /usr/sbin
sudo curl -O https://raw.githubusercontent.com/kcrawford/dockutil/ef55cb4cf94659074d4a4ea915e76fefbf322545/scripts/dockutil
#check for dockutil v 1.1.4 and if not there download it

sudo chmod +x /usr/sbin/dockutil
fi

###############################################################################
# Remove Dock items early #
###############################################################################
/usr/sbin/dockutil --remove 'Microsoft Word' --allhomes
/usr/sbin/dockutil --remove 'Microsoft Excel' --allhomes
/usr/sbin/dockutil --remove 'Microsoft Outlook' --allhomes
/usr/sbin/dockutil --remove 'Microsoft PowerPoint' --allhomes
/usr/sbin/dockutil --remove 'Microsoft Document Connection' --allhomes

log "removed from dock"
# Install receipts assingment
OFFICERECEIPTS=$(pkgutil --pkgs=com.microsoft.office*)
osascript -e 'tell application "Microsoft Database Daemon" to quit'
log "Kill Microsoft Database Daemon"

sudo rm -rf '/Applications/Microsoft Communicator.app/'
sudo rm -rf '/Applications/Microsoft Messenger.app/'
sudo rm -rf '/Applications/Microsoft Office 2011/'
sudo rm -rf '/Applications/Remote Desktop Connection.app/'
log "Remove apps"

sudo rm -rf '/Library/Application Support/Microsoft/'
sudo rm -rf '/Library/Automator/*Excel*'
sudo rm -rf '/Library/Automator/*Office*'
sudo rm -rf '/Library/Automator/*Outlook*'
sudo rm -rf '/Library/Automator/*PowerPoint*'
sudo rm -rf '/Library/Automator/*Word*'
sudo rm -rf '/Library/Automator/Add New Sheet to Workbooks.action'
sudo rm -rf '/Library/Automator/Create List from Data in Workbook.action'
sudo rm -rf '/Library/Automator/Create Table from Data in Workbook.action'
sudo rm -rf '/Library/Automator/Get Parent Presentations of Slides.action'
sudo rm -rf '/Library/Automator/Get Parent Workbooks.action'
sudo rm -rf '/Library/Automator/Set Document Settings.action'
sudo rm -rf '/Library/Fonts/Microsoft/'
sudo rm -rf '/Library/Internet Plug-Ins/*SharePoint*'
sudo rm -rf '/Library/LaunchDaemons/*Microsoft*'
sudo rm -rf '/Library/Preferences/*Microsoft*'
sudo rm -rf '/Library/PrivilegedHelperTools/*Microsoft*'
sudo rm -rf '$HOME/Library/Application Support/Microsoft/'
sudo rm -rf '$HOME/Library/Preferences/com.microsoft.*'

log "remove library items"

# Forget Install Receipts

for ARECEIPT in $OFFICERECEIPTS
do
pkgutil --forget $ARECEIPT
done

log "forgot receipts"
killall Dock
echo "All done, MS Office removed."
exit 0

Friday, 9 May 2014

Setting firefox preferences in macs for Oracle SSO to work.

#!/bin/bash
#Written by Tausif for FICO
#RESULT!
bloke=$(ls -l /dev/console | awk '{print $3}' )
place=$(sudo dscl . -read /Users/$bloke NFSHomeDirectory | awk '{print $2}')
logFile="/private/var/log/ff-mod.log"
log () {
echo $1
echo $(date "+%Y-%m-%d %H:%M:%S: ") $1 >> $logFile
}

set(){



if grep 'network.negotiate-auth.trusted-uris' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
then
sudo sed '/network.negotiate-auth.trusted-uris/d' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js > /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
echo 'user_pref("network.negotiate-auth.trusted-uris", "http://,https://");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
mv /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js
log "USER $bloke: network.negotiate-auth.trusted-uris is now set to http using SED";
else
echo 'user_pref("network.negotiate-auth.trusted-uris", "http://,https://");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
     log "USER $bloke: network.negotiate-auth.trusted-uris is now set to http";

fi
if grep 'network.negotiate-auth.gsslib' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
then
sudo sed '/network.negotiate-auth.gsslib/d' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js > /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
echo 'user_pref("network.negotiate-auth.gsslib", "1");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
mv /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js
log "USER $bloke: network.negotiate-auth.gsslib is now set to 1 using SED";
else
echo 'user_pref("network.negotiate-auth.gsslib", "1");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
     log "USER $bloke: network.negotiate-auth.gsslib is now set to 1";

fi
if grep 'network.negotiate-auth.delegation-uris' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
then
sudo sed '/network.negotiate-auth.delegation-uris/d' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js > /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
echo 'user_pref("network.negotiate-auth.delegation-uris", "http://,https://");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
mv /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js
log "USER $bloke: network.negotiate-auth.delegation-uris is now set to http using SED";
else
echo 'user_pref("network.negotiate-auth.delegation-uris", "http://,https://");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
    log "USER $bloke: network.negotiate-auth.delegation-uris is now set to http";

fi
}


pset(){
bloke=$(ls -l /dev/console | awk '{print $3}' )
place=$(sudo dscl . -read /Users/$bloke NFSHomeDirectory | awk '{print $2}')
#Get an array of all users
declare -a userarray
userarray=$(sudo /usr/bin/dscl . list /Users UniqueID | awk '$2 >= 500 && $2 < 100000000000000000 { print $1; }')
#Iterate through the array of all users
for i in ${userarray[@]};
do
if [ -d $place/Library/Application\ Support/Firefox/Profiles ];
then
#Get an array of all profiles under this User for Firefox
declare -a parray
parray=( `ls $place/Library/Application\ Support/Firefox/Profiles | grep -v DS_Store` )
for p in ${parray[@]};
do
if grep 'network.negotiate-auth.trusted-uris' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
then
sudo sed '/network.negotiate-auth.trusted-uris/d' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js > $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
echo 'user_pref("network.negotiate-auth.trusted-uris", "http://,https://");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
mv $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.trusted-uris is now set to http using SED";
else
echo 'user_pref("network.negotiate-auth.trusted-uris", "http://,https://");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.trusted-uris is now set to http";
fi
if grep 'network.negotiate-auth.gsslib' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
then
sudo sed '/network.negotiate-auth.gsslib/d' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js > $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
echo 'user_pref("network.negotiate-auth.gsslib", "1");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
mv $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.gsslib is now set to 1 using SED";
else
echo 'user_pref("network.negotiate-auth.gsslib", "1");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.gsslib is now set to 1";
fi
if grep 'network.negotiate-auth.delegation-uris' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
then
sudo sed '/network.negotiate-auth.delegation-uris/d' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js > $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
echo 'user_pref("network.negotiate-auth.delegation-uris", "http://,https://");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
mv $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.delegation-uris is now set to http using SED";
else
echo 'user_pref("network.negotiate-auth.delegation-uris", "http://,https://");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.delegation-uris is now set to http";
fi
done
fi
done

}

killFirefox(){

#LoginWindowPID=`pgrep firefox`; This command only works with 10.8 machines
ps -ax | grep -i "Firefox.app" | grep -v grep
if [ $? == 0 ];
then
firefoxPID=`ps -ax | grep -i firefox | head -1 | cut -d "?" -f1 | sed 's/^[ \t]*//;s/[ \t]*$//'`;
kill -9 $firefoxPID
log "Killing Firefox"
fi

}

killFirefox;
set;
pset;

exit 0;

Detect autopilot session

  Ensuring that some apps only install during autopilot is not easily accomplished, you can use the below powershell script as a requiremen...