How to connect automatically by scripts?

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
Luney5215
Posts: 2
Joined: Mon Mar 07, 2022 11:01 am

How to connect automatically by scripts?

Post by Luney5215 » Mon Mar 07, 2022 11:36 am

When I select a VPN server and try to connect it, but it always prompts me that failed to connect the VPN server, then I had to double-click the icon of VPN Gate Public VPN Relay Servers again, rearrange and select the next one, and try again and again until a certain one can be connected, sometimes even fail for dozens of times. Although it's just a mechanical way to click the mouse several times, can such an operation be replaced by a script?

solo
Posts: 1228
Joined: Sun Feb 14, 2021 10:31 am

Re: How to connect automatically by scripts?

Post by solo » Tue Mar 08, 2022 4:04 am

There is no command line access to VPN Gate Client Plugin's hosts list.
The command line features of SE VPN Client Manager are rather limited.

That said, I've just tested a usable workaround for scripted VPN Gate auto-connect. You will not like it but let's discuss and improve it.

#1 on https://www.vpngate.net/en/ pick a few of your preferred hosts.
For example currently the first top one: public-vpn-185.opengw.net

#2 in SE VPN Client Manager click 'add vpn connection' and enter:

Code: Select all

name: SRVA
host: public-vpn-185.opengw.net
port: 443
hub: VPNGATE
user: vpn
password: vpn
#3 ...add as many connections as you need

#4 create this "auto-connect.bat" batch file with the above connection names:

Code: Select all

@echo off
path=%path%;C:\Program Files\SoftEther VPN Client
::start
vpncmd /CLIENT localhost /CMD AccountRetrySet SRVA /NUM:0 /INTERVAL:5
vpncmd /CLIENT localhost /CMD AccountConnect SRVA
ping -n 10 127.0.0.1 >nul
vpncmd /CLIENT localhost /CMD AccountRetrySet SRVB /NUM:0 /INTERVAL:5
vpncmd /CLIENT localhost /CMD AccountConnect SRVB
ping -n 10 127.0.0.1 >nul
vpncmd /CLIENT localhost /CMD AccountRetrySet SRVC /NUM:0 /INTERVAL:5
vpncmd /CLIENT localhost /CMD AccountConnect SRVC
ping -n 10 127.0.0.1 >nul
:: ...etc...
::goto start
#5 double-click on "auto-connect.bat"

It will still require to cancel a failed connection popup but it is only a single mouse click :-)

Luney5215
Posts: 2
Joined: Mon Mar 07, 2022 11:01 am

Re: How to connect automatically by scripts?

Post by Luney5215 » Mon Mar 21, 2022 9:35 am

Thank you for your sincere reply to my question. I even think no one will pay attention to this. Although there is no script or plug-in to realize the operation I want, you do provide a good idea, and I will continue to try

Post Reply