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
pkill FortiClientAgent
pkill FctMiscAg
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
and
rm -Rfv /Applications/FortiClient.app
rm: /Applications/FortiClient.app/Contents: Operation not permitted
rm: /Applications/FortiClient.app: Operation not permitted
Could someone help me with this issue, please?
I need to uninstall FortiClient using a script via MDM on multiply devices