tell application "System Events" tell current location of network preferences set VPN to "VPN" set VPNactive to connected of current configuration of service VPN if VPNactive then disconnect service VPN else connect service VPN end if end tell end tell