I'd like to feed inputs to a command line interface for Cisco AnyConnect vpncli.exe (v2.3) to automate its (re)connection. It does not take username nor password as command line arguments, but reads those interactively from the user via the command line interface.
The vpncli.exe application uses ReadConsoleInput in order to read the password, that's way redirecting the password does not work. You can, though, use WriteConsoleInput. I have a small Python script that does exactly that:
This can be achieved by scheduling jobs through batch files to invoke the AnyConnect executable vpncli.exe. Getting familiarized with vpncli.exe on what parameters it takes will be helpful. Just invoke it via cmd prompt passing the help argument.
For the connection attempt, necessary information (i.e., tunnel group, credentials etc.,) required should be present in a text file and passed as an input to vpncli.exe. This SO post should be helpful.
The Cisco AnyConnect add-on use sendkeys to send information to the vpncli.exe window. The issue that we encounter is caused by the Windows UAC feature. Enabling/Disabling UAC on your computer should resolve the issue.
dca57bae1f