Posted on 11-21-2016 07:23 AM
I've been tasked by my IT security department to remove the Teamviewer app from our Macs. The versions range from 7 to 11. Is there a script or Terminal command that can accomplish this?
Posted on 11-21-2016 08:21 AM
There are a couple ways to do this. You can script it just to delete the application:
sudo rm -R /applications/Teamviewer.app
Or you could set it up as a restricted software and have it delete it when it's detected. This option is easier in my book.
Posted on 11-21-2016 08:39 AM
also, if you have a test instance of macOS + Composer, you can install it and capture the locations and then create a basic script to remove those paths.
Or setting restrictions should be able to help as well, before or after the removal.
Posted on 11-21-2016 09:32 AM
Here is what I use:
#!/bin/sh
if [[ -e /Applications/TeamViewerHost.app ]]; then
# TVHostV=`defaults read /Applications/TeamViewerHost.app/Contents/Info.plist CFBundleShortVersionString`
# echo "$TVHostV"
# if [[ $TVHostV = *"9."* ]]; then
rm -rf /Applications/TeamViewerHost.app
echo "TeamViewer found and removed"
#rm -f /Library/LaunchAgents/com.teamviewer.teamviewer_desktop.plist
#rm -f /Library/LaunchAgents/com.teamviewer.teamviewer.plist
rm -f /Library/LaunchAgents/com.teamviewer*
echo "LaunchAgents removed"
#rm -f /Library/LaunchDaemons/com.teamviewer.Helper.plist
#rm -f /Library/LaunchDaemons/com.teamviewer.teamviewer_service.plist
rm -f /Library/LaunchDaemons/com.teamviewer*
echo "LaunchDaemons removed"
#rm -f /Library/Preferences/com.teamviewer.teamviewer9.plist
rm -f /Library/Preferences/com.teamviewer*
echo "Preference file removed"
#rm -f /Library/PrivilegedHelperTools/com.teamviewer.Helper
rm -f /Library/PrivilegedHelperTools/com.teamviewer*
echo "Privileged Helper Tool file removed"
# fi
else echo "No TeamViewer Host found or wrong version"
fi
As you can see I have commented out the specific files, was easier just to add wildcard to the paths.
In the beginning you can also see that I first checked for the version (didn't want to remove the one I had updated), but commented out that as I handled it with a Smart Group instead.
Posted on 11-21-2016 10:11 AM
Thanks for the input everyone. Security wants me to proactively remove Teamviewer, but the restricted software policy would be useful too in case users try to reinstall it. I'll give each of these suggestions a try, thanks again.