Posted on 04-20-2021 11:56 PM
We are looking to mass remove Teamviewer via a script as on deployment we made the mistake of just deploying through a pkg file and not indexing with a dmg file.
I have tried 2 other scripts that I've found on Jamf forums but none of these have worked.
The Teamviewer versions are v15 full on some and v15 host on others
Devices generally all running Big Sur but there may be some running Catalina
Any assistance would be greatly appreciated
Posted on 04-22-2021 09:55 PM
Please test this a lot on test Macs before using it in production. I haven't done any testing with it. Use at your own risk, but might be a good jumping off point for you.
#!/bin/sh
# uninstaller for teamviewer host (messy version), would def need to clean this up more.
# Unload/Stop TeamViewer host
launchctl unload /Library/LaunchDaemons/com.teamviewer.Helper.plist
launchctl unload /Library/LaunchDeamons/com.teamviewer.teamviewer_service.plist
# Murder the process (if anything is still running)
killall TeamViewer_Desktop
killall TeamViewer_Service
# Remove TeamViewer Host app
if [ -d /Applications/TeamViewerHost.app ]; then
rm /Library/LaunchDaemons/com.teamviewer.Helper.plist
rm /Library/LaunchDeamons/com.teamviewer.teamviewer_service.plist
rm -Rf /Applications/TeamViewerHost.app
if [ $? = 0 ]; then
echo "Successfully removed TeamViewerHost.app from this Mac..."
else
echo "ERROR: Something failed when trying to remove TeamViewer from this Mac..."
exit 1
fi
else
echo "TeamViewer Host app not found on Mac"
fi
exit 0
Posted on 04-18-2024 07:27 AM
Just wanted to say thanks to the person who posted the above script. it was a big help for me. I've tweaked the code and from testing it a few times on my machines it seems to remove teamveiwerhost with only a slight movement of the dock when the uninstaller comes up and then the process gets killed.
Thought I'd share my script in case it helps anyone else. Given Jamf has recently returned Remote Desktop, I'm guessing a few people will might need to remove TeamVeiwerHost.
I'm fairly new at MacOS scripting so if anyone can see any glaring issue I'd be happy to hear from you :)
#!bin/sh
# Unload/Stop TeamViewer host
launchctl bootout system /Library/LaunchDaemons/com.teamviewer.Helper.plist
launchctl bootout system /Library/LaunchDeamons/com.teamviewer.teamviewer_service.plist
# Murder the process (if anything is still running)
pkill -9 TeamViewer_Desktop
pkill -9 TeamViewer_Desktop_Proxy
pkill -9 TeamViewer Host
pkill -9 TeamViewer_Service
# Remove TeamViewer Host app
if [ -d /Applications/TeamViewerHost.app ]; then
rm -f /Library/LaunchDaemons/com.teamviewer.*
rm -f /Library/LaunchAgents/com.teamviewer.teamviewer*
rm -f /Library/Preferences/com.teamviewer.teamviewer.preferences.plist
rm -fR /Library/Caches/com.teamviewer.TeamViewer.RemotePrinting/
rm -fR /Library/Application\ Support/TeamViewer\ Host/
rm -Rf /Applications/TeamViewerHost.app
if [ $? = 0 ]; then
echo "Successfully removed TeamViewerHost.app from this Mac..."
else
echo "ERROR: Something failed when trying to remove TeamViewer from this Mac..."
exit 1
fi
else
echo "TeamViewer Host app not found on Mac"
fi
#Kill the Teamveiwer uninstall process as all file are removed
sleep 10
pkill -9 TeamViewer Uninstaller
exit 0