Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Script to open VPN Anyconnect and Send Keys to it

Posted on 2015-02-23
1
176 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 69

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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
I recently attended Cisco Live! in Las Vegas, a conference that boasted over 28,000 techies in attendance, and a week of hands-on learning hosted by a solid partner with which Concerto goes to market.  Every year, Cisco displays cutting-edge technol…
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…

861 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