[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Script to open VPN Anyconnect and Send Keys to it

Posted on 2015-02-23
1
Medium Priority
?
238 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
[X]
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
1 Comment
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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…
Suggested Courses

656 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