Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
peter123
New Contributor

Shutdown FortiClient with cmd

Hello,

 

I want to shutdown the FortiClient with a cmd script. So how could I automate the following?

* Right-click on the FortiClient icon on the taskbar and select Shutdown FortiClient.

 

Best regards

Peter

4 REPLIES 4
maxs
New Contributor II

fortitray.exe --shutdown works however it needs to be executed in the logged-in user's session in with privileges (and the user needs to have local admin rights).

 

Doing this via SYSTEM(as a script) does not work.

rtichkule
Staff
Staff

Hello Peter,

 

 

You can use a CMD script to automate FortiClient shutdown by following these steps:

Open a text editor, such as Notepad.


Type the following command into the editor:

taskkill /im FortiClient.exe /t /f


The FortiClient process will be abruptly terminated by this command.

Use the.bat extension when saving the file.

Double-clicking the.bat file will start the script and end the FortiClient process.

JWIM
New Contributor

Hi there, should the below work for the VPN-only client? In practice it closes the console window, but the system tray and background processes persist, preventing uninstallation.


@rtichkule wrote:

Hello Peter,

 

 

You can use a CMD script to automate FortiClient shutdown by following these steps:

Open a text editor, such as Notepad.


Type the following command into the editor:

taskkill /im FortiClient.exe /t /f


The FortiClient process will be abruptly terminated by this command.

Use the.bat extension when saving the file.

Double-clicking the.bat file will start the script and end the FortiClient process.


 

dmorais
New Contributor

Hello,

I have found the following solution in order to stop Forticlient service for a script or other needs in cmd :

So at beginning of your upgrade script on PC or as cmd (with admin rights) -

 

 

 

sc config FA_Scheduler start=disabled && TASKKILL /F /IM scheduler.exe /T

 

 

 

  • (it will disable the auto startup of FortiClient VPN Service Scheduler and kill the process)

After the script finishes the update of Forticlient or if you want to relaunch the forticlient in cmd (with admin rights)

 

 

 

sc config FA_Scheduler start=auto && net start Fa_Scheduler

 

 

 

  • (it will enable again the automatic startup of Forticlient VPN Service Scheduler and start the service again)

This solution was tested with forticlient version 7.2.2, but it should work for other versions, just replace FA_Scheduler and corresponding executable for the service scheduler of forticlient

 

Regards,

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors