How to configure Cisco VPNUI shortcut to open a specific host?

Solution 1:

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

Solution 2:

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)

Solution 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...


Solution 4:

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