-
-
Save paveleremin/323cf97e97990278d5ae321573c55f71 to your computer and use it in GitHub Desktop.
Set WshShell = WScript.CreateObject("WScript.Shell") | |
WshShell.Run """%PROGRAMFILES(x86)%\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe""" | |
WScript.Sleep 1500 | |
WshShell.AppActivate "Cisco AnyConnect Secure Mobility Client" | |
WshShell.SendKeys "{TAB}" | |
WshShell.SendKeys "{TAB}" | |
WshShell.SendKeys "{ENTER}" | |
WScript.Sleep 3500 | |
WshShell.SendKeys "YourPassword" | |
WshShell.SendKeys "{ENTER}" |
In my case, it didn't work out of the box. I had to:
- Remove the first two TABs;
- Increase the second WScrip.Sleep from 3500 to 10000
- Add accolade brackets { } around a symbol from my password. If you have any of the following in your password %!(^~+ then you should wrap that symbol in accolades too.
Can't run this on Ubuntu.
Hi I used your script with windows 10 the only problem I encountered is the fact that it does not write the password on the screen.
Also in the preference.xml file I would need to set two
host do you know how?
Thanks so much for your cooperation
Works like a charm, I ended up with this:
(Change host and password with yours)
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """%PROGRAMFILES(x86)%\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe"""
WScript.Sleep 1500
WshShell.AppActivate "Cisco AnyConnect Secure Mobility Client"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "vpn.securehost.com"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 3500
WshShell.SendKeys "Password!$!#@"
WshShell.SendKeys "{ENTER}"
Cool! If you use special symbols in pass then enclose it by braces {}, for example {~} https://devguru.com/content/technologies/wsh/wshshell-sendkeys.html
I created a repo https://github.com/paveleremin/cisco-anyconnect-vpn-save-password
Let's continue there
Good Job Pavel! It works for me too.
Hi, thanks Pavel for sharing this script.
I'm very unfamiliar with vbs, and I'm not sure to understand how this script is triggered? Do we have to create a schedule task to run this script as the startup of the machine?
Any help to understand how this works would be appreciated.
Thanks Guys
Brilliant! Thanks so much.
How do I get this to work exactly? Do I need to run the script before I connect to the AnyConnect VPN?