When trying to establish a connection using the SonicWALL command line interface, I discovered that it returned long before the connection was established, leaving Royal TS waiting forever.
The script below solves the problem. In addition to passing the path to the SonicWALL executable, name of the connection, username and password, I pass the network to look for (like 192.168.10). I am using ipconfig to decide if the connection is up or not since an ip address in that net should appear in the result when a connection is established.
Royal TS Task Details: Command : <location>\SONICWALL_CONNECT.bat Arguments: "C:\Program Files\SonicWALL\SonicWALL Global VPN Client\SWGVC.exe" "<name>" "<user>" "<pwd>" "<net>"
SONICWALL_CONNECT.bat:
@echo OFF rem ---- start SonicWALL "Enable" %1 /E %2 /U %3 /P %4 rem ---- init loop counter set /a cnt=0 rem ---- start loop :again rem ---- check for assigned ip address in the specified net ipconfig | FIND /c %5 >NUL rem ---- errorlevel 0 means found, exit 0 if %errorlevel% equ 0 exit 0 set /a cnt+=1 rem ---- use ping on a non existing address to pause ping 1.1.1.1 -n 1 -w 250 >NUL rem ---- loop up to 40 times (10 seconds) if %cnt% lss 40 goto again rem ---- no success exit 1 exit 1
Thanks for sharing your solution. I'm constantly amazed what one can do with pure batch files!
cheers, Stefan
Our Forums are currently offline due to maintenance work.