Important note about SSL VPN compatibility for 20.0 MR1 with EoL SFOS versions and UTM9 OS. Learn more in the release notes.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help with Connect CLI

Can anyone help me with a batch script using the CLI?

IWe just recently moved from Dell SonicWall to Sophos. We had a few batch scripts utilizing the NetExtender CLI that I'd like to convert over to use with the Connect CLI.

 

The first is a connection script that first checks if the VPN is already connected and then connects if it isn't.

 

Here's what it looked like with NetExtender:


 

@echo off
set NEDIR="C:\Program Files (x86)\SonicWALL\SSL-VPN\NetExtender"
chdir /d %NEDIR%
for /f "Tokens=2" %%i in ('NECLI showstatus') do set NESTATUS=%%i
if %NESTATUS% == Disconnected (
start NEGui.exe
NECLI connect -s remote.architecturalpartners.com:4433 -u matt -p #Matt2017 -d ap.local
) else (
Echo Already Connected
)


 

I am definitely not a command prompt expert, so I've tried to make heads or tails out of this and convert it, but it's not working.

 

I was trying to use the sccli get command to get the status of a connection and search for the text "Connected: 0" which appers in the output, but I'm not doing something right. Again, just not knowing what I'm doing with Windows Command Prompt well enough.


 

set SCDIR="C:\Program Files (x86)\Sophos\Connect"
chdir /d %SCDIR%
for /f "Tokens=2" %%i in ('sccli get -n AP_Sophos_Connect') do set SCSTATUS=%%i
if sccli get -n AP_Sophos_Connect | findstr "Connected: 0" (
sccli enable -n AP_Sophos_Connect
) else (
Echo Already Connected
)


 

Any help is appreciated!!!

 

Thanks!

Matt



This thread was automatically locked due to age.
Parents Reply Children
No Data