FortiClient VPN Post Login Script

How to use FortiClient VPN Post Login Script


Run FortiClient SSL VPN Scripts from CLI

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, download from the Fortinet Support section. In addition to the FortiClient for Windows used here also the FortiClientTools

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.

FortiSSLVPNclient connect -h -u homer:password123 -i -q -m

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.

@echo off
START "" /I FortiSSLVPNclient connect -h -u homer:password123 -i -q -m
timeout 10
net use * /delete /yes
net use R: \\\data /user:homer password123 /persistent:no
REM further instructions!

With option connect -h will connect to the VPN gateway, belong 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. With the 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 Icon FortiSSLVPNclient, over which the context menu opens with a right-click.

The VPN connection can be disconnected with the following script.

@echo off
START "" /I FortiSSLVPNclient disconnect

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

Source link: Fortinet Knowledge Base

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

Leave a Reply

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