9

How do I configure the Cisco VPNUI client as a shortcut to open a specific host? As far as I can tell, the program doesn't take an command line arguments, or does it?

The problem is that the VPNUI.exe doesn't remember a history of VPNs you have connected to in the past, as most other software programs would do.

4 Answers 4

8

Yeah, looks like AnyConnect's GUI is completely ignorant of what's on the command line.

I can think of a couple options:

  1. Avoid the UI completely, and use vpncli.exe that's included by AnyConnect's installer
  2. Wrap a batch file around the vpnui.exe launch, swapping out the preferences.xml file with one containing the desired host. (on win7, my preferences.xml is in my profile at AppData\Roaming\Cisco\Cisco AnyConnect VPN Client)
5
  • I tried that suggestion. While the vpncli.exe works from the command line, I am unable to get it to load a profile.xml, preferences.xml, nor a AnyConnectProfile.xml from the C:\Program Files\Cisco\Cisco AnyConnect VPN Client\ directory . Anyone know how to do this?
    – djangofan
    Jul 6, 2011 at 23:28
  • 3
    To clarify, it was two separate suggestions; the UI client is the only thing that's gonna pay attention to preferences.xml, while the CLI client's configuration is all dictated by the command line (so, if you want, you can write a bunch of batch files running vpncli.exe connect host.domain.com). Jul 7, 2011 at 0:54
  • Yep, that works. Thanks. There was no need to edit any .xml file as far as I can tell. Just "vpncli.exe connect hostname" .
    – djangofan
    Jul 11, 2012 at 18:23
  • I know this is an old post, I just wanted to say thank you djangofan and Shane for the question/answer. I was hoping it supported some command line arguments, but I ended up doing option #2 and making a .BAT file to handle my preferences.xml. I'm going to look into the vpncli.exe option when I get some time. Apr 9, 2013 at 21:10
  • I want to confirm this solution is still valid. The vpncli.exe loads configurations stated in "C:\ProgramData\Cisco\Cisco Secure Client\VPN\preferences_global.xml"
    – Lucho
    Jan 10 at 11:21
9

you need to create an usual text file like

connect myvpnhost
myloginname
mypassword

save it as myfile.dat (for example) and then call

"%ProgramFiles%\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe" -s < myfile.dat
3

I'm having a similar issue however I was able to get multiple profiles by adding a second profile.xml to C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile. The ProgramData folder is/was hidden.

I originally had an AnyConnectVPN.xml file there, which I duplicated and renamed profile.xml with the information for my other connection. However when I run VPNCLI.exe connect <profile name> ... it still prompts for username and password which isn't very helpful...

3

Hi i tried a lot of things and the below is what worked for me

To connect to cisco anyconnect vpn using commandline from windows:

Install anyconnect using the installer

In powershell

create a file named vpn-cred.dat(any name would do) with following contents

    connect server-host
    y
    username
    password
    y

Then create a .cmd file with following contents in it

    cd "C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client" & .\vpncli -s < <path to vpn-cred.dat>

Then save it and execute it like .\vpn.cmd or whatever the filename is

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .