Solved

Script to open VPN Anyconnect and Send Keys to it

Posted on 2015-02-23
1
157 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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Like many others, when I created a Windows 2008 RRAS VPN server, I connected via PPTP, and still do, but there are problems that can arise from solely using PPTP.  One particular problem was that the CFO of the company used a Virgin Broadband Wirele…
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…
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…

772 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

11 Experts available now in Live!

Get 1:1 Help Now