If I’m removing the line “folder delete…” from the script, it runs successfully and able to uninstall the application from the endpoint but all folder still exist in the desired path.
Any help on this would be highly appreciated.
Commented in the other post that the error would appear for folder delete in the client log. If there was any error it would specify it more than an exit code. This exit code doesn’t come from the folder delete command, in your case it comes from the wait right before it.
I have used the below code and it’s working fine. Forticlient app and entire dir. has been removed from the machine but I can see FortiClient service still running in Activity Monitor.
I’m guessing that the FortiClient process respawns after you kill it and before it gets uninstalled. How does it get launched initially? If it’s a launch daemon (/Library/LaunchDaemon) then you can unload the daemon to prevent it from reloading (taking a guess at real plist name):
Hi @rustymyers
I’ve tried using the below script to uninstall the application from the endpoints and action has been completed from BigFix Side. But still FortiClient services exist in Activity Monitor.
And the main problem is until or unless this service get removed from Activity Monitor, We can not re-install the latest version of the FortiClient on the machine.
I’m unloading the launch agent which should remove FortiClientAgent service from the activity monitor.
However main FortiClient service has been removed successfully from the script.
Might be an order of operations. You would want to unload the daemons and then kill any residual apps. Try something like the following. I would also suggest running the commands through an SSH connection to see if they work of if you get errors. Figuring out how to remove it correctly through the terminal will help determine the steps that you need in the action script.
Be aware that telling a daemon to unload isn’t instantaneous. The BES Client for example takes a while to stop often and you will see code in the scripts we have to help you that wait for the service to stop. The “unload” returns immediately and the launch daemon process sends different messages to the daemon to try and stop it.
This way works and FortiClientAgent has been removed from the activity monitor. I’m able to push the Installation without any inconvenience.
Thank you so much @rustymyers
Using “unload” is still correct, but it can take a while after the command has been issued and returned for the daemon to actually shut down. You sometimes have to have a delay after the command or wait until it has actually shut down.