Skip to content

Instantly share code, notes, and snippets.

@netoxico
Created August 10, 2012 17:35
Show Gist options
  • Save netoxico/3315989 to your computer and use it in GitHub Desktop.
Save netoxico/3315989 to your computer and use it in GitHub Desktop.
Mac - Toggling VPN Connection
#!/bin/sh
osascript <<END
tell application "System Events"
tell current location of network preferences
set VPNservice to service "VPN-NAME"
set isConnected to connected of current configuration of VPNservice
if isConnected then
disconnect VPNservice
else
connect VPNservice
end if
end tell
end tell
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment