Search code examples
batch-filespecial-folders

Forticlient fcconfig .bat


I´m trying to make a .bat that executes Forticlient and import a backup with SSLVPN configuration, so the user only have to login with his credentials.

When I execute the .bat file it says Access denied, it opens Forticlient but doesn't import the backup file. I left you here the content .bat :

@echo off

C:

cd \Program Files\Fortinet\FortiClient

start Forticlient.exe

fcconfig -m vpn -f <c:\Users\administrator\Desktop\2.conf> -o importvpn -i 1 <------- This line says Access Denied (1)

exit

(1) I tried to open manually Fcconfig.exe but it says Access denied. I can't understand why doesn't let me type this command, because in the manual it says clearly type this lines in cmd and that's all. Here you have the manual, the page is 84 and 85.

If anyone could helpme let me know, thank you. Of course I want you to remember that I downloaded just Forticlient free, i didn´t paid for anymore services.


Solution

  • Copy this into your batch file, change nothing else, but the password:

    echo off
    pushd "C:\Program Files\Fortinet\FortiClient\"
    start "" Forticlient.exe
    fcconfig -m vpn -f "c:\Users\administrator\Desktop\2.conf" -o importvpn -i 1
    

    to run this for other users, where you will not know their username replace the last line with:

    fcconfig -m vpn -f "%USERPROFILE%\Desktop\2.conf" -o importvpn -i 1