You are not logged in.
Hello MacScripter Forums! I am a new member to these boards and this is my first post. First of all I am not a seasoned AppleScript user by any means. But I am trying to learn and this seems like the best place to do that. I have a script that turns VPN on and off depending on its current status; If on it turns off, If off it turns on. I didn't write this script, I found it (probably on this site though I can't be sure anymore.) It used to word flawlessly before upgrading to El Capitan. Now it only works if I setup and use L2TP when before I was using Cisco IPSec. When I try to use Cisco IPSec it returns this error:
error "System Events got an error: Can’t get current configuration of service id \"6508D6E2-6BE4-4698-913B-EDFECE4BE6B9\" of network preferences." number -1728 from current configuration of service id "6508D6E2-6BE4-4698-913B-EDFECE4BE6B9" of network preferences
Any and all help would be very much appreciated. Thank you.
Here is the AppleScript:
tell application "System Events"
tell current location of network preferences
set VPNservice to service "VPN (Cisco IPSec)"
if exists VPNservice then
set isConnected to connected of current configuration of VPNservice
if isConnected then
set msg to "Disconnected"
set isConnectedCheck to false
set x to 0
repeat 10 times
set x to (x + 1)
set isConnectedCheck to connected of current configuration of VPNservice
if isConnectedCheck then
set msg to "Connected success in " & (x * 2) & "s "
if not isConnectedCheck then
set msg to "Connect fail in 20s"
Browser: Safari 9.0.3
Operating System: Mac OS X (10.10)
I'm having the same problem after upgrading to Sierra. I tried recreating the VPN connection configuration, but that didn't matter. My next guess is the Cisco VPN client perhaps is to blame, but don't know enough about that yet to try a new version of it, but that's my next thing to try when I have some time.