In Mac OS X 10.11, Opening a VPN connection window with the command line gives me an error

后端 未结 5 671
伪装坚强ぢ
伪装坚强ぢ 2021-02-04 12:32

On Mac OS X <= 10.10, I could run the following command to open a VPN connection window:

function go-vpn {
/usr/bin/env osascript <<-EOF
tell applicatio         


        
5条回答
  •  粉色の甜心
    2021-02-04 13:03

    The Problem: The issue was I got this error.

    Can’t get «class svce» "MY VPN" of «class locc» of «class netp» of application "System Events".
    
    System Events got an error: Can’t get service "My VPN" of current location of network preferences. (-1728)
    

    The Reason: I am using IKEv2 services. It seems the Apple Script (which I found all over the internet) fails to work with this. You can find details in the link below.

    The solution: Timac wrote a script to solve this problem. I simply downloaded the precompiled app here. https://blog.timac.org/2018/0719-vpnstatus/

    If you are interested in the source code that makes it work, you can find it on GitHub here: https://github.com/Timac/VPNStatus

    You can also dig deeper into the problem if you are that sort of person on that link. It gives details.

    If you are simply looking for a solution to Auto Connect your VPN, the VPNstatus app worked for me.

提交回复
热议问题