Created
May 27, 2020 01:10
-
-
Save chuyeow/e771b6bdba89a7f45222174cc9a9ec53 to your computer and use it in GitHub Desktop.
Convenient way to connect to an IKEv2 VPN on macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set vpnServiceName to "Your VPN name in Network Preferences" | |
tell application "System Events" | |
tell process "SystemUIServer" | |
set vpnMenu to (menu bar item 1 of menu bar 1 where description is "VPN") | |
tell vpnMenu to click | |
set connectionStatusItem to (menu item 1 of menu 1 of vpnMenu) | |
if title of connectionStatusItem is equal to ("Connect " & vpnServiceName) then | |
tell connectionStatusItem to click | |
end if | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment