I'm trying to do the same thing. It works with all VPN connections except connections of type IKEv2.
Trying to run this script in Script Editor:
tell application "System Events"
tell current location of network preferences
set service_name to "IKEv2_connection_name"
do shell script (do shell script "scutil --nc start \"" & service_name & "\"")
end tell
end tell
And here is the error:
error "System Events got an error: No service" number 1
It appears that AppleScript cannot recognize the IKEv2 VPN connection. So I tried to run another script which to print out all the current internet connections in the system:
tell application "System Events"
tell current location of network preferences
set names to get name of every service
end tell
end tell
The result shows all the network connections (including "Wi-Fi", "USB Ethernet", "Bluetooth PAN", "Thunderbolt Bridge", all VPN connections of type L2TP, PTPP, IPSec) but it doesn't list any IKEv2 connections although I have set a few of them and they're all working.
Is this a known issue with El Capitan? Is there any workaround for this kind of VPN on El Capitan?