How to use FortiClient VPN Post Login Script

Run FortiClient SSL VPN from CLI and Scripts

This article describes how to use the FortiClient SSL VPN from the Windows command line, and apply from batch scripts. The FortiClient, available for FortiGate for all known operating systems, can be downloaded from the Fortinet Support section. In addition to the FortiClient for Windows used here, the FortiClientTools are also used.

FortiClient VPN

After the FortiClient is installed, we leave the VPN configuration left blank. Now the FortiClientTools are unpacked into a directory, of interest is the folder contents of SSLVPNcmdline, here the file FortiSSLVPNclient.exe is to be found, along with the Microsoft Visual C++ Redistributable mfc140.dll, msvcp140.dll, vcruntime140.dll runtime components.

Contents of SSLVPNcmdline

Running FortiSSLVPNclient.exe opens the GUI.

FortiClient SSLVPN

We decide not to use the VPN connection profile stored in Settings, instead to connect from CLI with append parameters.

It is now a good way to start the VPN connection with login and network drive mapping from the script, the following batch file should enable this.

With connect -h will connect to the VPN gateway, the IP address and the port number separated by a colon. The user -u who should log in to the gateway and the password after the colon. Cause timeout wait 10 seconds to VPN connection to be established before execute network drive mapping. The value may be reduced or it must be increased.

In the taskbar, the FortiSSLVPNclient icon, over which the context menu opens with a right click.

The VPN connection is disconnected with the following script.

FortiSSLVPNclient Command Line Usage
Usage: FortiSSLVPNclient.exe [options] [args]

Source link: Fortinet Knowledge Base

Leave a Reply

Your email address will not be published. Required fields are marked *