Search code examples
ciscokeepass

KeePass URL override for opening Cisco AnyConnect VPN connection


I'm using KeePass 2 for storing my passwords. I have to use several different VPN clients for connecting to our customers. I'm looking for URL override to allow automatic connection to given VPN server.


Solution

  • I’m finally succeeded with this definition:

    cmd://cmd /c "START /wait taskkill /F /IM vpnui.exe && "{ENV_PROGRAMFILES_X86}\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe" disconnect && (echo connect {URL:RMVSCM}&&echo {USERNAME}&&echo {PASSWORD})>c:\Windows\Temp\vpn.txt && "{ENV_PROGRAMFILES_X86}\Cisco\Cisco AnyConnect Secure Mobility Client\vpncli.exe" -s < c:\Windows\Temp\vpn.txt && del c:\Windows\Temp\vpn.txt && "{ENV_PROGRAMFILES_X86}\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe" "
    

    It basically creates a temporary file with vpn address, login and password and pass this file to vpncli. However vpnui must be closed first and I prefer to start it afterwards (to be able to comfortably close connection, when I don’t need it anymore).

    Hope it helps someone :-)