Skip to main content

Hi,



How would i completely remove Office 2011 on a network via Casper/JSS?



I've found the 12 step guide to removing the software from Microsoft: http://support.microsoft.com/kb/2398768/en-us



Would i do this while running composer to create a package and send out?

Create a script that kills all the locations the article refers to and push it out with a policy targeted to systems with Office 2011


This has been resolved with a series of policies to remove all the settings etc.


was Office 2011 installed via casper? if so, index the pkg ..create a policy to remove from those clients you wish to remove it from.


I'm using the following script to remove Office 2011 in preparation to install Office 2016. However, I just realized I'm not sure how to tell it to remove ~/Library/Application Support/Microsoft/Office



This folder contains Script Menu scripts, templates, etc., for O-2011 that won't be needed anymore. I need to weed this folder out of every user's home folder. I'm not sure if I should use the path I put above, or if there's another way of phrasing it since it has to work on any user's home folder.



#!/bin/sh
osascript -e 'tell application "Microsoft Database Daemon" to quit'
osascript -e 'tell application "Microsoft AU Daemon" to quit'
osascript -e 'tell application "Office365Service" to quit'
rm -R '/Applications/Microsoft Communicator.app/'
rm -R '/Applications/Microsoft Messenger.app/'
rm -R '/Applications/Microsoft Office 2011/'
rm -R '/Applications/Remote Desktop Connection.app/'
rm -R '/Library/Application Support/Microsoft/MAU2.0'
rm -R '/Library/Application Support/Microsoft/MERP2.0'
rm -R /Library/Automator/*Excel*
rm -R /Library/Automator/*Office*
rm -R /Library/Automator/*Outlook*
rm -R /Library/Automator/*PowerPoint*
rm -R /Library/Automator/*Word*
rm -R /Library/Automator/*Workbook*
rm -R '/Library/Automator/Get Parent Presentations of Slides.action'
rm -R '/Library/Automator/Set Document Settings.action'
rm -R /Library/Fonts/Microsoft/
rm -R /Library/Internet Plug-Ins/SharePoint*
rm -R /Library/LaunchDaemons/com.microsoft.*
rm -R '/Library/Preferences/com.microsoft.office.licensing.plist'
rm -R /Library/PrivilegedHelperTools/com.microsoft.*
OFFICERECEIPTS=$(pkgutil --pkgs=com.microsoft.office.*)
for ARECEIPT in $OFFICERECEIPTS
do
pkgutil --forget $ARECEIPT
done
exit 0

@itupshot



for user in $(ls /Users/); do
echo "Checking user: $user"
if [ -d "/Users/$user/Library/Application Support/Microsoft/Office" ]; then
echo "Found folder for user ${user}. Removing..."
rm -Rfd "/Users/$user/Library/Application Support/Microsoft/Office"
fi
done

@mm2270 Thanks for the tip! I'll try that. I need to run a test of my script on a couple of machines today.


@itupshot Have you had a chance to update / test your script? I am looking for an uninstaller for when we roll out 2016 later this month.


Any luck with this it is the last linc in my Office 2016 Deploy log..Got rm -rf "/Applications/Microsoft Office 2011" to work in terminal,but not in script
M


Is it safe to run this after 2016 has been installed? so far I am seeing O16 makes new files, assuming it makes new files of everything and does not use any left behind by O11.


I am going to try this script on a test system and see how it works, I am going to run pre and post O16 install. Has anyone had any issues with this?


Office 2011 and Office 2016 share no common files except for the Microsoft AutoUpdate tool found in /Library/Application Support/Microsoft. If you run your script to remove Outlook 2011 then be sure use an octothorp (I LOVE that word!) to comment this line and keep it from running:



# rm -R '/Library/Application Support/Microsoft/MAU2.0'


Two other parts of the script remove pieces in the /Library folder via wildcard. Either comment these lines too or specify the exact file to remove for Office 2011:



# rm -R /Library/LaunchDaemons/com.microsoft.*


or



rm -R /Library/LaunchDaemons/com.microsoft.office.licensing.helper.plist


As well as:



# rm -R /Library/PrivilegedHelperTools/com.microsoft.*


or



rm -R /Library/PrivilegedHelperTools/com.microsoft.office.licensing.helper

i want the office 2011 to remove the autoupdate. I am managing updates of 2016 via Casper policy when an update to office 2016 is available.



rm -R '/Library/Application Support/Microsoft/MAU2.0'



my office 2016 install policy uses a choices.xml that leaves out OUTLOOK and AutoUpdate



so if i don't remove MAU2.0, then my Office2016 install uses it for AutoUpdate


Will Office 2016 pick up any existing prefs that users might have set - i.e. perhaps we should leave them in place?


@anpender depends on the app and what prefs, but i don't think there's much being shared between the two apps in terms of preferences. i think Auto Update still uses some similar prefs. a lot of things were also moved to an sqlite database. i'm not sure if the office apps will attempt to read from prefs in previous version of Office apps on first run or during install. might be worth testing. but i work off the assumption that it does not transfer those prefs over (except Outlook which does try to import accounts/settings if you previously had it setup).


Anyone have a fully baked version of this script? I would love to be able to push this out to get rid of office 2011 on our macs what already have office 2016 installed, were new to the macs being managed this way, thus no old packages to reference.


@Goose02 Give the macadmins.software site a shot.


Here is the script I use to uninstall Office 2011. It also removes dock icons (we use dockutil)



#!/bin/sh

osascript -e 'tell application "Microsoft Database Daemon" to quit'
osascript -e 'tell application "Microsoft AU Daemon" to quit'
osascript -e 'tell application "Office365Service" to quit'


/bin/test -e '/Applications/Microsoft Office 2011/Microsoft Word.app/' && /usr/local/bin/dockutil --remove 'Microsoft Word' --allhomes --no-restart
/bin/test -e '/Applications/Microsoft Office 2011/Microsoft Outlook.app/' && /usr/local/bin/dockutil --remove 'Microsoft Outlook' --allhomes --no-restart
/bin/test -e '/Applications/Microsoft Office 2011/Microsoft PowerPoint.app/' && /usr/local/bin/dockutil --remove 'Microsoft PowerPoint' --allhomes --no-restart
/bin/test -e '/Applications/Microsoft Office 2011/Microsoft Excel.app/' && /usr/local/bin/dockutil --remove 'Microsoft Excel' --allhomes --no-restart
/bin/test -e '/Applications/Microsoft Communicator.app/' && /usr/local/bin/dockutil --remove 'Microsoft Communicator' --allhomes --no-restart
/bin/test -e '/Applications/Microsoft Messenger.app/' && /usr/local/bin/dockutil --remove 'Microsoft Messenger' --allhomes --no-restart
/bin/test -e '/Applications/Microsoft Office 2011/Microsoft Document Connection.app/' && /usr/local/bin/dockutil --remove 'Microsoft Document Connection' --allhomes --no-restart
/bin/test -e '/Applications/Remote Desktop Connection.app/' && /usr/local/bin/dockutil --remove 'Remote Desktop Connection' --allhomes --no-restart

killall Dock


/bin/test -e '/Applications/Microsoft Communicator.app/' && rm -R '/Applications/Microsoft Communicator.app/'
/bin/test -e '/Applications/Microsoft Lync.app/' && rm -R '/Applications/Microsoft Lync.app/'
/bin/test -e '/Applications/Microsoft Messenger.app/' && rm -R '/Applications/Microsoft Messenger.app/'
/bin/test -e '/Applications/Remote Desktop Connection.app/' && rm -R '/Applications/Remote Desktop Connection.app/'

rm -R '/Applications/Microsoft Office 2011/'

rm -R '/Library/Application Support/Microsoft/'
rm -R /Library/Automator/*Excel*
rm -R /Library/Automator/*Office*
rm -R /Library/Automator/*Outlook*
rm -R /Library/Automator/*PowerPoint*
rm -R /Library/Automator/*Word*
rm -R /Library/Automator/*Workbook*
rm -R '/Library/Automator/Get Parent Presentations of Slides.action'
rm -R '/Library/Automator/Set Document Settings.action'

rm -R /Library/Internet Plug-Ins/SharePoint*
rm -R /Library/LaunchDaemons/com.microsoft.office.licensing.helper.plist
rm -R /Library/Preferences/com.microsoft.office.licensing.plist
rm -R /Library/PrivilegedHelperTools/com.microsoft.office.licensing.helper

rm -R /Library/Fonts/Microsoft/

mv '/Library/Fonts Disabled/Arial Bold Italic.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Arial Bold.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Arial Italic.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Arial.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Brush Script.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Times New Roman Bold Italic.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Times New Roman Bold.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Times New Roman Italic.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Times New Roman.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Verdana Bold Italic.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Verdana Bold.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Verdana Italic.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Verdana.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Wingdings 2.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Wingdings 3.ttf' /Library/Fonts
mv '/Library/Fonts Disabled/Wingdings.ttf' /Library/Fonts

exit 0


Hope that helps!


@pbowden with Microsoft has written a removal script for Office 2011. You'll find it here:



https://github.com/pbowden-msft/Remove2011/blob/master/Remove2011



I believe I made this work with a Jamf policy by adding this as a script to Jamf and under the Options tab setting the label for Parameter 4 to "Additional Arguments". Then I added the script to a policy and entered --Force in the Additional Arguments field.



Test this and if it doesn't work, you may also need to change $1 to $4 on line 435 of the script.


@talkingmoose



Did you have any instances where 2011 and 2016 were installed side by side? If so - how did you differentiate?


@acaveny, installing 2011 and 2016 side-by-side is fully supported by Microsoft. They share no common files or preferences other than Microsoft AutoUpdate.



The paths to the applications is the easiest way to differentiate the two installs. Office 2011 installs its apps together in '/Applications/Microsoft Office 2011' and Office 2016 installs its apps loose in the /Applications folder.


@talkingmoose - this is what i get when i run the policy to uninstall office 2011 using the script. I setup the additional arguments and the --Force



Script exit code: 1
Script result: [0;34m=== Microsoft Office 2011 for Mac Removal Tool 1.3 ===[0m
Usage: SNHS-Remove Office 2011.sh [--Force] [--Help] [--SaveLicense]
Use --Force to bypass warnings and forcibly remove Office 2011 applications and data
Error running script: return code was 1.


gonna change line 435 to key="$4". i'll let you know what happens


I get the same error result when changing line 435 to $4



here is the error logged in the casper policy



Running script Uninstall Office 2011.sh...
Script exit code: 1
Script result: [0;34m=== Microsoft Office 2011 for Mac Removal Tool 1.3 ===[0m
Usage: Uninstall Office 2011.sh [--Force] [--Help] [--SaveLicense]
Use --Force to bypass warnings and forcibly remove Office 2011 applications and data
Error running script: return code was 1.



---- below is the part of the script code

Evaluate command-line arguments



if [[ $# = 0 ]]; then
LogMessage "No command-line arguments passed, going into interactive mode"
MainLoop
else
LogMessage "Command-line arguments passed, attempting to parse"
while [[ $# > 0 ]]
do
key="$4" <-------------------------------------------------- this is line 435
LogMessage "Argument: $key"
case $key in
--Help|-h|--help)
ShowUsage
exit 0
shift # past argument
;;
--Force|-f|--force)
LogMessage "Force mode set to TRUE"
FORCE_PERM=true
shift # past argument
;;
--SaveLicense|-s|--savelicense)
LogMessage "SaveLicense set to TRUE"
SAVE_LICENSE=true
shift # past argument
;;
*)
ShowUsage
exit 1
;;
esac
shift # past argument or value
done
MainLoop
fi

@tcandela, I've made this work for another customer. I'll need to go check my notes and test a little. I'll let you know what I find.


@tcandela, following are my changes to @pbowden's Remove 2011 script to make it work with Jamf:



Line 21 - change:
touch $LOG_FILE to
touch "$LOG_FILE"



Line 437 - change:
case $key in to
case "$key" in



Line 454 - change:
ShowUsage to
echo "Ignoring unrecognized argument: $key"



Line 455 - change:
exit 1 to
# exit 1



When adding the script contents to Jamf, be sure to set the "Parameter 4" label under the Options tab to something like "Additional Parameter 1".



When adding the script to your removal policy, be sure to set the "Additional Parameter 1" field to "--Force".



Removing user preferences [ Optional ]



Note the script supports removing the current user's preference files. That means, if running from Jamf, it'll attempt to remove root's preferences (those probably don't exist) and will leave preferences in user home folders alone. If you want to remove preferences in all user home folders, open the script in a plain text editor such as BBEdit or TextWrangler and use Find/Replace to change all references of:



$HOME to
/Users/*



Troubleshooting



I found during my testing if I call the policy via Terminal, the script log gets placed into the top level of the current user's home folder. It can be useful for troubleshooting should you need it:



sudo jamf policy -id 38 <-- Replace "38" with the ID number of your own removal policy found in the URL