Forcing MacBooks to one network

ahopkins
New Contributor II

We have MacBook airs in our high school. There is a profile that allows them to join our student network.

We also have a guest network, and now many students were joining that. I didn't set the network preference to require an admin password to join other networks. I have a script for that. I need a script that will clear out the cache so the student computers won't go to the guest network, and stay on the student network.

Here is what I used so far, with help from Jamf support;

/usr/sbin/networksetup -removeallpreferredwirelessnetworks "$GUESTNETWORK"
/usr/sbin/networksetup -setairportpower en0 on
/usr/sbin/networksetup -setairportnetwork en0 "$SSID" "$PASSWORD"

/usr/libexec/airportd en0 prefs RequireAdminIBSS=YES
/usr/libexec/airportd en0 prefs RequireAdminNetworkChange=YES
/usr/libexec/airportd en0 prefs RequireAdminPowerToggle=YES
/usr/libexec/airportd en0 prefs RememberRecentNetworks=NO

this seemed to work when I put it in. Self service. However. If a student logged out or restarted, the computer wants to join the guest network. I can manually do this, but doing this 688 times is not how I want to spend my Monday. We also have Apple Remote Desktop... Don't know if this would help in anyway

3 REPLIES 3

chriscollins
Valued Contributor

Have you also tried setting the preferred wireless network order so that it tries to go to your desired wifi network first?

We had an issue where we have traditionally had office wifi networks that were password protected but would only go to the internet and when on that users would VPN in to get to corporate resources. In some offices we've started rolling out 802.1x wifi networks with a different SSID. People would connect fine to that network but the problem was since they had connected to the non-802.1x network first in the past, it had a higher network preference order so often when users would come back into the office, it would connect to the restricted wifi first.

You can control the preferred order of wifi networks via a script but the problem is if the SSID already exists in that preferred order list, you have to remove it first then re-add it at index 0.

So I ended up writing a short simple script that would look at the preferred wifi order and if the 802.1x SSID was in it, it would remove it then add it back at the top of the list and if it wasn't already there it would just add it. Took care of the problem for us.

ahopkins
New Contributor II

Haven't tried that. i have to find out what exactly we are in. I know we have arubas.

ahopkins
New Contributor II

Got it to work! On the above code I changed the first line to not include the specific name of the network. On the last line I changed the remember networks to Yes

We also removed the guest network in our school for the week. This helped the computers to join just the instructional network we want them on, and the others were deleted from computer.