Anyone know of a way to complete this, i have machines with vpn profiles that are not all nam,ed the same. I want to standardize the adapter via a configuration profile , is there a way to script the removal of a profile with the name VPN in the service title?
Solved
Delete VPN Profile from CommandLine
Best answer by justinrummel
I assume your VPN settings are using L2TP (vs. PPTP). To test and see what we may remove, I would create an extension attribute to record the value of:
system_profiler SPNetworkDataType | grep -B2 L2TP | head -n 1 | awk '{gsub(":", "", $1); print $1}'
This will give you a list of all the VPN settings that are L2TP. You can then verify the names by doing a custom report, and if you are happy base a new script that will then delete the network service that is found.
#!/bin/sh
ns=`system_profiler SPNetworkDataType | grep -B2 L2TP | head -n 1 | awk '{gsub(":", "", $1); print $1}'`
echo "Now removing ${ns}"
sudo networksetup -removenetworkservice "${ns}"
exit 0Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
