Skip to content

Instantly share code, notes, and snippets.

@deardooley
Last active September 22, 2020 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deardooley/66b65917afb012588b2484dd0f7cc063 to your computer and use it in GitHub Desktop.
Save deardooley/66b65917afb012588b2484dd0f7cc063 to your computer and use it in GitHub Desktop.
Applescript for Cisco VPN autologin on OSX

This is a little AppleScript utility for mac that will allow you to login to Cisco vpn without manually entering your password over and over again.

  1. Open Script Editor on your mac.
  2. Paste in the file contents.
  3. Update with your username, password, and vpn name.
  4. Save to disk somewhere it won't get accidentally deleted. (~/Library/Scripts/cisco-vpn.scpt).
  5. Add an alias to your environment to call the script whenever you want to login to vpn: alias vpnup='osascript ~/Library/Scripts/dmc-vpn.scpt'
set vpn_name to "'<your Cisco IPSec VPN config name from Settings->Network>'"
set user_name to "<username>"
set passwd to "<password>"
tell application "System Events"
set rc to do shell script "scutil --nc status " & vpn_name
if rc starts with "Disconnected" then
do shell script "scutil --nc start " & vpn_name & " --user " & user_name
delay 2
keystroke passwd
keystroke return
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment