Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


Dopamean

9 posts

Wannabe Geek


#101855 10-May-2012 12:45
Send private message

Hello,

As part of looking at ways to reduce some cost one of our alternatives is the anywhere connect SSL Cisco VPN client.

Within the directory of this VPN software is an added on vpncli command interface.
It has simple option's such as _

connect / state / disconnect / etc...
Basically I am able to connect via this command line.

The UI side of the VPN client has no features for automation, my objective (if possible) is to
automate the connection over general DSL, don't worry so much about the "security" issues this poses.
The user side of the Thin Client has no access to the C drive, nor will they be able to access anything other than what is specified around the AD privialage, and there after additional authentication is required also.

I've come into ICT later in life so would have "missed" the era where writing these sorts of file would have been very common.

Essentially I need something that will do this:

*****************************************************************************

Echo.  >>c:\vpnbatch.txt
Echo.=================== >>c:\vpnbatch.txt
echo.%Date% >>c:\vpnbatch.txt
echo.%Time% >>c:\vpnbatch.txt

START "C:\vpncli.exe" connect somedomain user someuser pwd somepassword


*****************************************************************************

There may be some plain as day problems with this script, I know it's not functional :P
Can anyone help me out with this and please give direct copy pastes of what it should look like.

If it's not possible without a hybrid script of some sort I'd still like to look at it but would need some guidance.

Cheers guys. 

EDIT: This topic may need to be moved just looking at the avalible forums.

Create new topic

gzt

gzt
17111 posts

Uber Geek

Lifetime subscriber

  #623380 11-May-2012 09:23
Send private message

Perhaps you could explain the overall objectives of what you are trying to achieve. There may be a better way to achieve the same outcome. If you have a reference for the available command set that would be helpful.



jamesrt
1609 posts

Uber Geek

ID Verified
Trusted
Lifetime subscriber

  #623398 11-May-2012 09:44
Send private message

Dopamean:

*****************************************************************************

Echo.  >>c:\vpnbatch.txt
Echo.=================== >>c:\vpnbatch.txt
echo.%Date% >>c:\vpnbatch.txt
echo.%Time% >>c:\vpnbatch.txt

START "C:\vpncli.exe" connect somedomain user someuser pwd somepassword


*****************************************************************************


It's very unclear what you're trying to achieve here - presume the first 4 lines are just building logfile entries ?

At any rate, for the "Start" line, the syntax isn't entirely right for "modern" Windows.  It probably would have worked for Windows 95, but for WinXP and above, you'll probably need something more like:

start "" "C:\vpncli.exe" connect somedomain user someuser pwd somepassword

as the first parameter to "start" is the "window title", which is what I've set to "" here.

The second issue which leaps out is that your "vpncli.exe" path probably isn't "C:\vpncli.exe" - the full path to the file should be specified here, for example "c:\program files\vpnclient\vpncli.exe" (or whatever).  Quotes will be required if the path contains spaces.

"help start" from a command prompt will give you some good guidance on the "start" command.

Dopamean

9 posts

Wannabe Geek


  #623432 11-May-2012 10:51
Send private message

jamesrt:
Dopamean:

*****************************************************************************

Echo.  >>c:\vpnbatch.txt
Echo.=================== >>c:\vpnbatch.txt
echo.%Date% >>c:\vpnbatch.txt
echo.%Time% >>c:\vpnbatch.txt

START "C:\vpncli.exe" connect somedomain user someuser pwd somepassword


*****************************************************************************


It's very unclear what you're trying to achieve here - presume the first 4 lines are just building logfile entries ?

At any rate, for the "Start" line, the syntax isn't entirely right for "modern" Windows.  It probably would have worked for Windows 95, but for WinXP and above, you'll probably need something more like:

start "" "C:\vpncli.exe" connect somedomain user someuser pwd somepassword

as the first parameter to "start" is the "window title", which is what I've set to "" here.

The second issue which leaps out is that your "vpncli.exe" path probably isn't "C:\vpncli.exe" - the full path to the file should be specified here, for example "c:\program files\vpnclient\vpncli.exe" (or whatever).  Quotes will be required if the path contains spaces.

"help start" from a command prompt will give you some good guidance on the "start" command.


Hi James,

Thanks for your reply.
You are correct the first four lines is for capturing a log file.
As for the initial application start line, I don’t believe it really matters where I place the application.
The client cannot see the C drive anyways, I'm writing this on a win7 x64 box so I've edited the install path.

My objective is to automate the login of the VPN client on login.
Again I have limited no I'll say no skills when it comes to scripting, this is a learning experience :)

I can launch the UI of the VPN client with scheduled tasks, that’s not an issue.
The problem with this is that I need to cater for the lowest denominator.
I don't want to have to manage user's forgetting their usernames/passwords.

Security wise there are two authentication steps already, I don't want to burden the user with another.
The outcome could mean a large reduction in costs for our business.

It could be done now, however again as explained above I'd like to make it seamless for the user so I am perusing it down this route.

Perhaps there is a better way, I’d like to know, thanks.



stevenz
2802 posts

Uber Geek


  #623433 11-May-2012 11:05
Send private message

AutoIt + Scite ftw for automation scripting.

But,

Echo. >>c:\vpnbatch.txt
Echo.=================== >>c:\vpnbatch.txt
echo.%Date% >>c:\vpnbatch.txt
echo.%Time% >>c:\vpnbatch.txt
START "C:\vpncli.exe" connect somedomain user someuser pwd somepassword


You don't need the . character after "Echo" (ok with it though)

The initial line should have a single > otherwise you'll keep appending to the existing file (unless that's your intent?)

The final line should work fine without the word START or the quote characters, unless you need to pass the filepath for the VPNCLI. START is mainly useful if you want to control how it's run, if you don't care then just run it directly.

A better bet would be to write a proper Profile file for the client and it should then autolaunch.

If you want the connection parameters to be defined by the script then replace "somedomain", "someuser" and "somepassword" with %1, %2 and %3 respectively. Plaintext passwords are a bad thing though.

Does running the vpncli.exe directly with the intended values work? The binary should be in "C:\Program Files\Cisco\Cisco AnyConnect VPN Client" - not in the root of C:




gzt

gzt
17111 posts

Uber Geek

Lifetime subscriber

  #623434 11-May-2012 11:12
Send private message

stevenz: A better bet would be to write a proper Profile file for the client and it should then autolaunch.

+1.

Dopamean

9 posts

Wannabe Geek


  #623483 11-May-2012 12:16
Send private message

Does running the vpncli.exe directly with the intended values work? The binary should be in "C:\Program Files\Cisco\Cisco AnyConnect VPN Client" - not in the root of C:


No it does not currently that's the second part I'm working though, again this is a first attempt at such a thing.  I have found a wait technique to allow the VPN software time to establish a connection which is nice.
*****************************
ECHO Waiting 10 seconds
PING 1.1.1.1 -n 1 -w 5000 > NUL 
*****************************

I have also downloaded the recommended software which appears to allow you to turn the batch file to an .exe?  - I assume this feature will allow me to add to scheduled tasks upon login.
Things are looking up.

But I do need some help around having the details entered into the cli to establish the connection, I've been playing but have not got it working as yet.

May be after some lunch =D

Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.