Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

AnyConnect Client CLI Scripting Help?

I need a method/script that will help me launch the anyconnect client from the command line of a windows machine and login to the ssl vpn. Then I need to know if this script can be scheduled in windows scheduler. I have attached what I have so far. This still requires human interaction. Anyone have a better way? (What the hell happend to file attachment capabilities here?)

'================================================================================

'

' FILE: VPN_ON.VBS CREATION DATE: 8/06/2008 AUTHOR: ****

'

' PURPOSE: AUTOMATE THE CONNECTION WITH THE IPASS/CISCO ANYCONNECT VPN CLIENT

'

' 8/06/2008 - JA - INITIAL VERSION

' 8/07/2008 - JA - ADDED LOCK WORKSTATION FUNCTION

'

'================================================================================

'Define Contants

Dim strPassword, strVpnClient, strWinDir, colSystemEnvVars, strUserName

'Create Shell Objects

set WshShell = WScript.CreateObject("WScript.Shell")

WScript.Sleep 30000

Set colSystemEnvVars = WshShell.Environment("System")

'Process Variables

'========================================

'-=Customize your username below.=-

strUserName = "username"

'========================================

'-=Customize your password below.=-

strPassword = "password"

'========================================

strVpnClient = "C:\Program Files\Cisco\Cisco AnyConnect VPN Client\vpncli.exe"

strWinDir = colSystemEnvVars("windir")

'Launch VPN Client

WshShell.Run "cmd /c " & Chr(34) & strVpnClient & Chr(34)

'Send Keystokes to VPN Client

WScript.Sleep 1000

WshShell.AppActivate strWinDir & "\system32\cmd.exe"

WshShell.SendKeys "connect isa.site.com{ENTER}"

WScript.Sleep 5000

'-=Send the username=-

WshShell.AppActivate strWinDir & "\system32\cmd.exe"

WshShell.SendKeys strUserName & "{ENTER}"

WScript.Sleep 1000

'-=Send the password=-

WshShell.AppActivate strWinDir & "\system32\cmd.exe"

WshShell.SendKeys strPassword & "{ENTER}"

WScript.Sleep 10000

'-=Exit the VPN Client, it wil stay connected.=-

WshShell.AppActivate strWinDir & "\system32\cmd.exe"

WshShell.SendKeys "exit{ENTER}"

'Lock the Workstation

WshShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"

1154
Views
0
Helpful
0
Replies
CreatePlease to create content