Skip to content

Instantly share code, notes, and snippets.

@oskarhagberg
Created December 5, 2009 07:37
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 oskarhagberg/249610 to your computer and use it in GitHub Desktop.
Save oskarhagberg/249610 to your computer and use it in GitHub Desktop.
AppleScript for toggling connection to a specific VPN network
tell application "System Events"
tell current location of network preferences
set VPNservice to service "VPN Service Name goes here"
if exists VPNservice then
set isConnected to connected of current configuration of VPNservice
if isConnected then
disconnect VPNservice
else
connect VPNservice
end if
end if
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment