Posted on 09-19-2013 12:34 AM
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?
Posted on 09-19-2013 04:51 AM
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
Posted on 09-20-2013 02:28 AM
This has been resolved with a series of policies to remove all the settings etc.
Posted on 09-20-2013 05:59 AM
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.
Posted on 12-11-2015 10:14 AM
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
Posted on 12-11-2015 10:37 AM
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
Posted on 12-11-2015 12:00 PM
@mm2270 Thanks for the tip! I'll try that. I need to run a test of my script on a couple of machines today.
Posted on 01-07-2016 06:25 AM
@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.
Posted on 01-25-2016 03:31 PM
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
Posted on 02-01-2016 10:21 AM
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.
Posted on 02-01-2016 10:34 AM
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?
Posted on 02-07-2016 08:36 AM
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
Posted on 02-07-2016 02:28 PM
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
Posted on 02-24-2016 09:32 AM
Will Office 2016 pick up any existing prefs that users might have set - i.e. perhaps we should leave them in place?
Posted on 02-24-2016 10:02 AM
@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).
Posted on 08-31-2017 04:55 PM
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.
Posted on 08-31-2017 04:58 PM
@Goose02 Give the macadmins.software site a shot.
Posted on 08-31-2017 08:51 PM
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!
Posted on 08-31-2017 09:00 PM
@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.
Posted on 09-07-2017 08:19 AM
Did you have any instances where 2011 and 2016 were installed side by side? If so - how did you differentiate?
Posted on 09-07-2017 09:30 AM
@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.
Posted on 09-15-2017 12:23 PM
@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.
Posted on 09-20-2017 08:29 AM
gonna change line 435 to key="$4". i'll let you know what happens
Posted on 09-20-2017 10:16 AM
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 codeEvaluate 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
Posted on 09-21-2017 08:01 AM
@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.
Posted on 09-23-2017 11:31 AM
@tcandela, following are my changes to @pbowden's Remove 2011 script to make it work with Jamf:
Line 21 - change:touch $LOG_FILE
totouch "$LOG_FILE"
Line 437 - change:case $key in
tocase "$key" in
Line 454 - change:ShowUsage
toecho "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
Posted on 09-23-2017 12:47 PM
@talkingmoose talk do I need to still keep line 435 to key="$4" ?
Posted on 09-23-2017 01:17 PM
@tcandela, only the changes I mentioned above. Leave line 435 as-is.
Posted on 09-25-2017 09:22 AM
@talkingmoose hey, I made those 4 changes to the script
kept line 435 to key="$1"
"Parameter 4" label under the Options tab to something like Additional Parameter (no quotes)
Additional Parameter 1 field to --Force (no quotes)
left all the $HOME alone for now in the script
testing soon
Posted on 09-25-2017 10:12 AM
@talkingmoose hey, 'moose' it worked. results of the script are below.
what i'm trying to do now is 'clean the dock' of any Office 2011 dock items that the user might have added to their dock. In the Script i see the function that does this removal, but the code in this function is based on using DOCKUTIL
these computers do not have DOCKUTIL installed, so i'm trying to adjust the ELSE clause to specifically go into the dock and remove any office 2011 items. The CleanDock function is below.
i understand the dock.plist for each user is in Dock preferences are in ~/Library/Preferences/com.apple.dock.plist
would just a refresh of the users Dock eliminate any Office 2011 dock items? I might put this Office 2011 uninstall in Self Service for the person to run it.
function CleanDock { LogMessage "In function 'CleanDock'" FormattedConsoleMessage "%-55s" "Cleaning icons in dock" if [ -e "$WORKING_FOLDER/dockutil" ]; then LogMessage "Found DockUtil tool" sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20Document%20Connection.app/" --no-restart sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20Word.app/" --no-restart sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20Excel.app/" --no-restart sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20PowerPoint.app/" --no-restart sudo "$WORKING_FOLDER"/dockutil --remove "file:///Applications/Microsoft%20Office%202011/Microsoft%20Outlook.app/" LogMessage "Completed dock clean-up" ConsoleMessage "${TEXT_GREEN}Success${TEXT_NORMAL}" else ConsoleMessage "${TEXT_YELLOW}Not detected${TEXT_NORMAL}" fi }
Running script Uninstall Office 2011.sh... Script exit code: 0 Script result: [0;34m=== Microsoft Office 2011 for Mac Removal Tool 1.3 ===[0m Removing Office 2011 Applications [0;32mSuccess[0m Removing Launch Daemon: Licensing Helper [0;32mSuccess[0m Removing Helper Tools: Licensing Helper [0;32mSuccess[0m Removing Office Fonts [0;32mSuccess[0m Removing Product License [0;32mSuccess[0m Removing Error Reporting [0;32mSuccess[0m Removing Application Support [0;32mSuccess[0m Removing Browser Font Cache [0;33mNot detected[0m Removing Setup Assistant Cache [0;33mNot detected[0m Removing Office Cache [0;32mSuccess[0m Removing Outlook Identity Cache [0;33mNot detected[0m Removing Outlook Cache [0;33mNot detected[0m Removing Preferences [0;32mSuccess[0m Preserving Outlook Identities and Databases [0;32mSuccess[0m Preserving Outlook Saved Attachments [0;33mNot detected[0m Preserving Outlook Sound Sets [0;33mNot detected[0m Removing Package Receipts [0;32mSuccess[0m Cleaning icons in dock [0;33mNot detected[0m Restarting Preferences Daemon [0;32mSuccess[0m All events and errors were logged to /var/folders/4r/9z7hv6t9571_9cwj2dpt57z40000gn/T/Uninstall Office 2011.sh.log
Posted on 09-25-2017 12:17 PM
This script (Remove2011) asks a few questions at the beginning. How to I set it up so that the answers are predetermined so there's no user interaction?
Posted on 09-26-2017 05:41 AM
@tcandela, I suggest simply using dockutil. It's good. It's simple and it works well. It can remove a dock icon from all user home folders as well as the User Template. Just deploy it along with the script.
Posted on 10-03-2017 08:14 AM
@talkingmoose I just ran the script again and noticed it does not remove the following folder
/library/application support/microsoft/mau2.0 /library/application support/microsoft
so i had to do it manually
I want auto updates removed because i have office 2016 updates run through casper policies
checking the script to see where i can add this
should i add this to the main loop in the following section
RemoveComponent "/Library/Application Support/Microsoft/MAU2.0" "Auto Update"
Posted on 10-03-2017 08:23 AM
@tcandela, you'll have to add that to the script yourself.
The script was written to remove Office 2011 but it and Office 2016 share the Microsoft AutoUpdate (MAU) tool. Therefore, the script doesn't delete what may have been installed by Office 2016.
Rather than remove MAU using this script, you may want to create another smaller script that does just this and run it separately on machines where you find it's installed.
Posted on 10-03-2017 08:52 AM
@talkingmoose I just added
RemoveComponent "/Library/Application Support/Microsoft/MAU2.0" "Auto Update"
RemoveComponent "/Library/Application Support/Microsoft" "Microsoft App Support Folder"
should do it, testing soon
so now that section looks like this
# Remove Office 2011 application support RemoveComponent "/Library/Application Support/Microsoft/MERP2.0" "Error Reporting" RemoveComponent "/Library/Application Support/Microsoft/MAU2.0" "Auto Update" RemoveComponent "$HOME/Library/Application Support/Microsoft/Office" "Application Support" RemoveComponent "/Library/Application Support/Microsoft" "Microsoft App Support Folder"
Posted on 10-03-2017 09:45 AM
@talkingmoose hey, it works, I could have probable just did this single line, removing MERP2.0 & MAU2.0
RemoveComponent "/Library/Application Support/Microsoft" "Microsoft App Support Folder"
what is this following line? --> RemoveComponent "$HOME/Library/Application Support/Microsoft/Office" "Application Support"
I am confused about $HOME --> where is this referring to ?
Posted on 10-03-2017 11:54 AM
@tcandela, most any word you see in a shell script like this that begins with $ means it's a variable — a placeholder for another piece of information.
In this case, if you run echo $HOME
in Terminal, you'll see it returns the path to your own home folder. If my username is mmoose then $HOME means /Users/mmoose
.
And if you see something like $HOME/Library/Preferences/com.mircrosoft.Word.plist
then that expands to /Users/mmoose/Library/Preferences/com.mircrosoft.Word.plist
.
Keep in mind that $HOME is relative to whoever is logged in and running the script.
Posted on 10-10-2017 01:59 PM
@talkingmoose - dumb question but I figure you can answer it quickly. When you said above
@tcandela, I suggest simply using dockutil. It's good. It's simple and it works well. It can remove a dock icon from all user home folders as well as the User Template. Just deploy it along with the script.
Do you mean add the dockutil script to the policy along with the modified Remove2011 script? When I do that, the policy returns with an error because dockutil tries to run and doesn't have any arguments supplied. How exactly do you suggest "deploying it along with the script?"
Thanks!
Posted on 10-12-2017 06:25 AM
@sag969, Dockutil is meant to be deployed to systems and reside there for other scripts to call. Wherever you decide to put it, you'll need to update the path in @pbowden's script to point to Dockutil.
Looks like his script declares a variable near the top:
WORKING_FOLDER=$(dirname "$0")
This appears to only be for describing where Dockutil lives on the Mac. You should be able to set this to something like:
WORKING_FOLDER="/private/tmp"
Then, package the Dockutil tool using Composer and deploy it to the /private/tmp folder. I know some administrators like to keep Dockutil on all their Macs for future use. You want want to instead deploy it permanently to a place like "/Library/Company Name/Scripts" and call it from there.
I haven't tested this, but from what I see in the script, it should work this way.
Posted on 10-12-2017 11:23 AM
@talkingmoose @sag969 Just a word of caution that you should use the version of Dockutil that I supply with the Remove2011 script at https://github.com/pbowden-msft/Remove2011 as it contains a couple of tweaks of Kyle's base version, that has better handling for icon removal of Office apps.