Hi all,
I'm trying to uninstall FortiClient on macbook with M1/M2 processor using a script from this article: https://community.fortinet.com/t5/FortiClient/Technical-Tip-Uninstall-FortiClient-using-a-script-on-...
I only added two lines to change flags. Here is my script:
#!/bin/sh
# Uninstall FortiClient.sh
pkill FortiClient
launchctl unload /Library/LaunchDaemons/com.fortinet*
chflags -hv noschg /Applications/FortiClient.app
chflags -hv noschg /Applications/FortiClientUninstaller.app
rm -Rfv /Applications/FortiClient.app
rm -Rfv /Applications/FortiClientUninstaller.app
rm -Rfv /Library/Application\ Support/Fortinet
rm -Rfv /Library/Internet\ Plug-Ins FortiClient_SSLVPN_Plugin.bundle
rm -Rfv '/Library/LaunchDaemons/com.fortinet.forticlient.vpn.plist'
rm -Rfv '/Library/LaunchDaemons/com.fortinet.forticlient.wf.plist'
rm -Rfv '/Library/LaunchDaemons/com.fortinet.forticlient.fmon.plist'
rm -Rfv '/Library/LaunchDaemons/com.fortinet.forticlient.epctrl.plist'
rm -Rfv '/Library/LaunchDaemons/com.fortinet.forticlient.appfw.plist'
rm -Rfv '/Library/LaunchDaemons/com.fortinet.forticlient.fssoagent_launchdaemon.plist'
localAccounts=$(dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }')
for user in $localAccounts ;
do
rm -Rfv /Users/"$user"/Library/Application\ Support/Fortinet/
done
But I got error that deleting FortiClient.app and FortiClient.app\Content is not permitted, because application is locked. At this time, FortiClientUninstaller.app has been deleted successfully:
chflags: /Applications/FortiClient.app: Operation not permitted
/Applications/FortiClientUninstaller.app
Could someone help me with this issue, please?
Solved! Go to Solution.
The problem was solved by providing full disk access to Terminal
Hello Webster
I think this is a MacOS security related question, right?
Did you try from single user mode?
Hello AEK,
I didn't try, because I need to execute this script via MDM solution to multiple devices. I had the same problem with GUI uninstaller of FortiClient, but after adding string with changing flags, this problem was solved
The problem was solved by providing full disk access to Terminal
Thanks for sharing this post! But no idea about this particular problem
You do realise that FortiClient uninstaller does all that, and is normally already installed. This is my script I use in Jamf Pro:
#!/bin/sh
OldUnInstaller="/Applications/FortiClientUninstaller.app/Contents/MacOS/Uninstall"
UnInstaller="/Applications/FortiClientUninstaller.app/Contents/Library/LaunchServices/com.fortinet.forticlient.uninstall_helper"
if [ -e "$UnInstaller" ]; then
"$UnInstaller" upgrade-uninstall
elif [ -e "$OldUnInstaller" ]; then
"$OldUnInstaller"
else
echo "$(date) - Error: Uninstaller not found."
exit 1
fi
That else block could contain your script then as a backup (replacing the exit 1), and the upgrade-uninstall options allows the uninstaller to run quietly. Possibly consider removing the else if and OldUnInstaller references as well.
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1737 | |
1107 | |
752 | |
447 | |
240 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.