How do I set a specific system setting using a script or a profile? System Preferences/Networks/WiFi/Require authorisation to turn wifi on/off

I'm hoping someone can help. I work for a college, I manage about 80 Macs and we've had a problem recently where students are turning WiFi on or off on the Macs that they're logging on to. This is bad for the hard-wired Macs as they haven't been provisioned on our managed Wireless system so it either slows down their network connection or kills it entirely and it's bad for the mobile Macs as they loose their connection to the network and they start whinging that they can't get on the internet.

I found the following setting in System preferences which looks like it will solve my problem: System Preferences Setting

Does anyone know how to set this setting programmatically, using a script or a profile or whatever?

I've found the plist which contains the setting, it is /Library/Preferences/SystemConfiguration/preferences.plist. However, the setting itself is buried quite deeply in the file and my attempts to toggle it using defaults write and plistbuddy have ended in horrible failure. I've also tried creating a custom profile using Profile Manager but that hasn't worked either.

All of the Macs are running Mavericks.

I don't want to have to go around to 80 Macs and set this by hand so any hints or the solution would be greatly appreciated!

Thanks,

Ian


Solution 1:

See Toggle Ability to turn wifi off which shows how to do so from the command line using a script:

#!/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

This question had been answered previously, see Enable Admin Authorization to Change wireless Networks, also on jamfnation. Seems to be a common question for school IT admins.

I found these answers being curious about what you found by using the key from the preferences.plist file (RequireAdminPowerToggle) and using Google search.