Posted on 07-24-2017 10:25 AM
I recently discovered that my Mac has been creating network connections for every iPad I have prepared with Apple Configurator 2. Now, there are hundreds of connections. I need a way to delete them all/reset network preferences and prevent this from happening again.
Posted on 07-24-2017 12:22 PM
I didn't want to delete my network interfaces so I didn't test. But this should give you enough to do something with... It'll delete any network interface with USB in the name.
#!/bin/sh
#todd h
IFS=$'
'
networkService=`networksetup -listallnetworkservices | tail -n +2 | sed 's|*||'`
for oneServ in ${networkService[@]}; do
case $oneServ in
*USB* )
echo "found USB in $oneServ. Deleting"
networksetup -removenetworkservice $oneServ
;;
*)
echo "Not a USB interface. Ignoring $oneServ"
;;
esac
done
Posted on 06-27-2018 06:57 PM
Posted on 06-27-2018 07:18 PM
Nevermind figured it out, expanded on @thoule 's script. Running the remove on sudo so you only have to authenticate once.
#!/bin/sh
IFS=$'
'
networkService=`networksetup -listallnetworkservices | tail -n +2 | sed 's|*||'`
for oneServ in ${networkService[@]}; do
case $oneServ in
*USB* )
echo "found USB in $oneServ. Deleting"
sudo networksetup -deletepppoeservice $oneServ
;;
*)
echo "Not a USB interface. Ignoring $oneServ"
;;
esac
done