Posted on 07-24-2013 07:38 AM
In network preferences / Advanced, there's a checkbox to "Require Administrator Authorization to turn wi-fi on or off" that I want checked ("true") for all of our computers on our network. I found the preferences.plist file that stores this checkbox value (/Library/Preferences/SystemConfiguration/preferences.plist), but I'm no "scripter".
Does anyone know how to write a script that would effectively change the RequireAdminPowerToggle section of that plist file from "false" to "true"? I can't roll that entire plist file out to every computer via a policy because I don't want to change ComputerName for all of our computers. In other words, I can't have this particular plist file for every computer on our network - I just need that value changed from false to true.
Can anybody help? I wish I knew more about scripting...
Solved! Go to Solution.
Posted on 07-24-2013 07:54 AM
You can do that and much more from that panel with this little script. You can remove preferences if you don't need them, but I decided to keep them in for easy reference to all the options.
#!/bin/sh
# Get "Wi-Fi" or "Airport" based on your OS
wservice=`/usr/sbin/networksetup -listallnetworkservices | grep -Ei '(Wi-Fi|AirPort)'`
# Get port (usually en1)
whwport=`/usr/sbin/networksetup -listallhardwareports | awk "/$wservice/,/Ethernet Address/" | awk 'NR==2' | cut -d " " -f 2`
# Set preferences
/usr/libexec/airportd "$whwport" prefs DisconnectOnLogout=Yes JoinMode=Automatic JoinModeFallback=DoNothing RememberRecentNetworks=No RequireAdminIBSS=Yes RequireAdminNetworkChange=No RequireAdminPowerToggle=Yes
Edit: I should note that I run this on 10.8 machines. While airportd exists all the way back to 10.5, the specific options may have changed in that time and this exact script may need to be modified for other versions.
Posted on 07-24-2013 07:54 AM
You can do that and much more from that panel with this little script. You can remove preferences if you don't need them, but I decided to keep them in for easy reference to all the options.
#!/bin/sh
# Get "Wi-Fi" or "Airport" based on your OS
wservice=`/usr/sbin/networksetup -listallnetworkservices | grep -Ei '(Wi-Fi|AirPort)'`
# Get port (usually en1)
whwport=`/usr/sbin/networksetup -listallhardwareports | awk "/$wservice/,/Ethernet Address/" | awk 'NR==2' | cut -d " " -f 2`
# Set preferences
/usr/libexec/airportd "$whwport" prefs DisconnectOnLogout=Yes JoinMode=Automatic JoinModeFallback=DoNothing RememberRecentNetworks=No RequireAdminIBSS=Yes RequireAdminNetworkChange=No RequireAdminPowerToggle=Yes
Edit: I should note that I run this on 10.8 machines. While airportd exists all the way back to 10.5, the specific options may have changed in that time and this exact script may need to be modified for other versions.
Posted on 07-24-2013 08:09 AM
I took what I needed out of that and it worked great.
Thanks!
Posted on 07-24-2013 08:14 AM
Not a problem, I'm glad it worked for you.
Posted on 07-24-2013 05:14 PM
Also you can use this simple one (taken from a post by cbrewer). We use this on our 10.8 machines and works fine.
#!/bin/sh
/usr/libexec/airportd prefs RequireAdminPowerToggle=YES