Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bogdanw

macrumors 603
Original poster
Mar 10, 2009
6,144
3,042
For me, the VPN menu in Ventura’s settings app didn’t work properly. WireGuard and IKEv2 connection were not always initiated when toggling the button.
I’ve deleted the Ventura volume today, but I’ve saved this AppleScript I used to easily connect to VPNs. Maybe someone finds it helpful.
Code:
set theVPNs to {"VPN1", "VPN2", "VPN3"}
set the selectedVPN to choose from list the theVPNs with prompt "Please select a VPN connection:" default items {"VPN2"}
if selectedVPN = {"VPN1"} then
    do shell script "scutil --nc start 'VPN1'"
end if
if selectedVPN = {"VPN2"} then
    do shell script "scutil --nc start 'VPN2'"
end if
if selectedVPN = {"VPN3"} then
    do shell script "scutil --nc start 'VPN3'"
end if
It can be saved as an app from Script Editor. 3 connections are just as an example, you can add more.
A simple script, that can be saved as an app, to turn off all VPN connections:
Code:
do shell script "scutil --nc stop 'VPN1'"
do shell script "scutil --nc stop 'VPN2'"
do shell script "scutil --nc stop 'VPN3'"
Additional options can be added to each, like turning Ethernet/Wi-Fi on or off.
Wi-Fi on
Code:
do shell script "networksetup -setairportpower en0 on"
Wi-Fi off
Code:
do shell script "networksetup -setairportpower en0 off"
Ethernet on
Code:
do shell script "networksetup -setnetworkserviceenabled Ethernet on"
Ethernet off
Code:
do shell script "networksetup -setnetworkserviceenabled Ethernet off"
There are other scripts available online and there is also VPNStatus https://github.com/Timac/VPNStatus , but I haven’t tested it in Ventura.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.