Solved

Script to open VPN Anyconnect and Send Keys to it

Posted on 2015-02-23
1
166 Views
Last Modified: 2015-07-08
Hi All,

I'm using Visual Studio to create an SSIS package with a script task using script language Microsoft Visual Basic 2012 to open the vpncli.exe and connect to a server "000.00.00.000" with username "TestName" and password "TestPassword"

I'm having difficulties in sending keystrokes to the app, the app looks like dos. For example the steps that I put in is as follows:
Open vpncli.exe
>connect "000.00.00.000"
{enter}
"TestName"
{enter}
"TestPassword"
{enter}

I need this script to automate my login.

Regards
0
Comment
Question by:cErasmus
1 Comment
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40638275
What i use with PowerShell is this (works for x86 machines this way):
Add-Type -Assembly System.Windows.Forms

Push-Location 'C:\Programme\Cisco\Cisco AnyConnect Secure Mobility Client'

Start-Service vpnagent | Out-Null
Start-Process 'vpncli.exe' -Argumentlist 'connect 000.000.000.000'
sleep 3
'', 'TestName', 'TestPassword' | % {
  sleep -m 100
  [Windows.Forms.SendKeys]::SendWait("$_{ENTER}") 
}

Open in new window

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now