Posted on 07-20-2020 06:51 AM
Anyone have or know where i can get a good office 2016 uninstall script?
I see a handful around but they all are different. Some look to just remove the /applications and user folders related to office 2016, while others remove /applications, user folders and system folders related to office 2016.
looking to have something that will remove office 2016 cleanly (via Self Service policy) to have office 2019 then installed with no issues (via Self Service Policy).
thank you
Posted on 07-20-2020 08:17 AM
Posted on 07-20-2020 08:32 AM
I've been doing this via Self Service
#!/bin/bash
if test “/Applications/Microsoft Excel.app”;then rm -rf /Applications/Microsoft Excel.app;fi
if test "/Applications/Microsoft OneNote.app";then rm -rf /Applications/Microsoft OneNote.app;fi
if test “/Applications/Microsoft Outlook.app”;then rm -rf /Applications/Microsoft Outlook.app;fi
if test "/Applications/Microsoft PowerPoint.app";then rm -rf /Applications/Microsoft PowerPoint.app;fi
if test "/Applications/Microsoft Word.app";then rm -rf /Applications/Microsoft Word.app;fi
Posted on 07-20-2020 09:57 AM
Hello @tcandela this is what we have been using in both self service policies or in conjunction with installs of Office to remove all the cruft of previous installs, prior to the actual install:
procList="Microsoft"
for proc in "${procList[@]}"
do runningProc=$(ps axc | grep -i "$proc" | awk '{print $1}') if [[ $runningProc ]]; then echo "$proc is running with PID: ${runningProc}"
kill -s HUP $runningProc
else
echo "$proc not running"
fi
done
array=(/Applications/Microsoft
/Library/Applications/OneDrive
/Library/Application Support/Microsoft
/Library/LaunchAgents/com.microsoft.
/Library/LaunchDaemons/com.microsoft.
/Library/Logs/Microsoft
/Library/Preferences/com.microsoft.
/Library/PrivilegedHelperTools/com.microsoft.
/private/var/root/Library/Group Containers/*.Office
)
for i in "${array[@]}"
do
if [ -d "$i" ]
then
sudo rm -R "$i"
else
if [ -e "$i" ]
then
sudo rm -R "$i"
else
echo "No Additional Microsoft Files or Folders Found in $i."
fi
fi
done
exit
Posted on 07-20-2020 11:36 AM
@mconners does that script also remove previous licensing information? for example licensing info from Office 2016?
is this good for uninstalling office 2019 also?
I don't want any possible license issues if 2016 is removed and 2019 is installed afterwards.
when either office version gets installed i use whichevers Office versions VL serializer.
Posted on 07-20-2020 11:40 AM
@tcandela I don't believe it touches the license files. We have already migrated over to 2019 so for us, I didn't need to worry about licensing information. I would follow with what @sdagley mentioned above regarding the license removal piece. Then if you wish, you could run my script to remove additional files installed by Office.
Once a friend guided me along with the use of the array in the script, I have adapted it to other uninstalls and it has made the world of difference for me. Perhaps if you added into this script, the location of the license files, then you could remove them with a single script.
Posted on 07-24-2020 07:38 AM
@atomczynski hi there, hey, the short bash script you wrote only removes the Office 2016 applications. Doesn't remove any system or user related office files. Are you just then installing another version say 2019 in it's place?
Posted on 07-24-2020 08:48 AM
@tcandela Correct. We install the 2019 serializer tool and Office 2019 suite.
Posted on 07-24-2020 09:04 AM
@atomczynski ok, so you're just removing the 2016 applications. Installing 2019 and VL serializer after the 2016 apps are removed will be fine?
Ive tested exactly that a couple days ago and 2019 installed and is VL licensed.
is each of your if statements doing a check if that particular office .app exists? I'm not 100% sure if that TEST command is making that check??? because on most of the macs here we don't install ONENOTE and OUTLOOK. but if a computer happens to have ONENOTE or OUTLOOK then RM it.
i don't see an 'else' clause, so wondering if a computer that doesn't have ONENOTE/OUTLOOK and gets to the RM line will the script continue or fail
Posted on 07-24-2020 09:08 AM
I'm not sure if I can add anything to this now. If I can find a machine with old version of Office I'll dive into it.
I have a policy that installs the VL tool and then Office 2019.
Posted on 07-24-2020 09:34 AM
@atomczynski no need to add to it, i know how. was just curious if you know what happens with the TEST command if the particular office application doesn't exist.