@mrperrott ,
I use the following commands below to (1) remove all SSID's from the preferred network list in system preferences and (2) then add any networks I like the user to have back. I would add this in Self Service because it does need admin rights to run.
Note the following:
- Removes all preffered networks (the user will need to reconnect to their home network overtime after running this).
- Then adds a specific network back. Make sure you define SSID, ENCRYPTION, PASSWORD of the network you are adding (quotes are not needed).
- Needs administrator rights.
networksetup -removeallpreferredwirelessnetworks en0
networksetup -addpreferredwirelessnetworkatindex en0 SSID 0 ENCRYPTION PASSWORD
Hope this solves your issue,
Jared
If this is a known SSID, then I do something similar, that might target what you're looking for. I run a EA that checks against
#!/bin/sh
wifi=`networksetup -listpreferredwirelessnetworks en0 | grep 'WIRELESS NETWORK NAME' || echo "No"`
echo "<result>$wifi</result>"
and if it's found during a recon, gets added to a smart group tied to an ongoing policy that executes
#!/bin/sh
networksetup -removepreferredwirelessnetwork en0 'WIRELESS NETWORK NAME'
exit 0
But again, assumes you know the SSID. If you don't know the SSID, then yeah, dumping all of them would be the brute force way to do it.