#!/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-data file-data _CFURLString /Applications/Microsoft Office 2011/Microsoft Word.app _CFURLStringType 0 "
sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "tile-data file-data _CFURLString /Applications/Microsoft Office 2011/Microsoft Excel.app _CFURLStringType 0 "
sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "tile-data file-data _CFURLString /Applications/Microsoft Office 2011/Microsoft PowerPoint.app _CFURLStringType 0 "
sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "tile-data file-data _CFURLString /Applications/Microsoft Office 2011/Microsoft Outlook.app _CFURLStringType 0 "
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
# 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 "
sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "
sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "
sudo -u $cuser defaults write $uhome/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "
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