Auto configure Mac airport (wireless) settings from the command line

These are the settings we use on school owned laptops used exclusively on our campus.

Thanks to netman for giving me an alternative to

/usr/bin/defaults write /Library/Preferences/SystemConfiguration/preferences RememberRecentNetworks -boolean false

which does not work as expected. 


/usr/sbin/networksetup -removeallpreferredwirelessnetworks AirPort
/usr/sbin/networksetup -setairportpower en1 on
/usr/sbin/networksetup -setairportnetwork AirPort "$SSID" "$password"
/usr/libexec/airportd en1 prefs RequireAdminIBSS=YES
/usr/libexec/airportd en1 prefs RequireAdminNetworkChange=YES
/usr/libexec/airportd en1 prefs RequireAdminPowerToggle=YES
/usr/libexec/airportd en1 prefs RememberRecentNetworks=NO
© 2011 Adam Gerson.