Skip to main content

Hi All!
So I've done my research on this already around JAMF Nation and everyone seems to be able to disable wifi completely wether its through managed prefs or a config profile. I have a script running that turns off wifi if hard lined and in turn if not hard lined allow wifi. This is for a lab setting so they really don't need wifi.



What I want to do is to hide the icon in the menu bar through JAMF. There is a check box in network prefs "Show wifi status in menu bar" that if unchecked hides it. I tried doing a snapshot with composer but that didn't work out.



Also theres a few other prefs I was hoping to add as well. In advanced wifi prefs I want to have checked "Require admin authorization to: create computer to computer networks, change networks, turn wifi on or off." That way even if they become disconnected from from ethernet they would still need an administrator to turn on wifi. Any help or direction with this would be greatly appreciated!
-George

So, the plist that governs whether or not the Wi-Fi icon displays is located here: ~/Library/Preferences/com.apple.systemuiserver.plist. I've spent a little time trying to modify it with defaults write, and it's proving to be a little difficult to remove that specific AirPort menu icon. Defaults doesn't do the best job with deleting from array indexes. Easiest way forward for this would either be to remove the /System/Library/CoreServices/Menu Extras/AirPort.menu string manually from the plist (through Property List Editor or another GUI plist editor) and then either capture and deploy it to all existing users and user templates via Composer, or you can turn it into a Custom Payload by customizing the plist and then uploading it to the JSS and deploying it from there as a Config Profile.



As far as toggling those admin authorization options, you can manipulate them with airportd. If you're calling these scripts from the JSS, they'll run as root (so no need for the sudo below), but otherwise, you'll want to run something like these:



sudo /usr/libexec/airportd en0 prefs RequireAdminIBSS=YES
sudo /usr/libexec/airportd en0 prefs RequireAdminNetworkChange=YES
sudo /usr/libexec/airportd en0 prefs RequireAdminPowerToggle=YES


It'll probably be either en0 or en1, depending which network interface governs wireless on your machines.


Instead of en0 or en1 you can just run first



WIFIIF=`/usr/sbin/networksetup -listallhardwareports | grep -A 1 Wi-Fi | awk '/Device/{ print $2 }'`


And then use the result:



sudo /usr/libexec/airportd $WIFIIF prefs RequireAdminIBSS=YES
sudo /usr/libexec/airportd $WIFIIF prefs RequireAdminNetworkChange=YES
sudo /usr/libexec/airportd $WIFIIF prefs RequireAdminPowerToggle=YES

Good call, @tobiaslinder. That'll apply those admin required settings to your wireless interface regardless of en#.


FWIW, PlistBuddy can remove entries from the array in that plist, but the problem is, you need to use an index value to remove it, rather than a string, I believe, which means you need to figure out which index the entry for the Wifi menu icon would be in the array first. If, for example, its the 4th item in the array, you'd use 3 (since arrays start at 0)
You can print it with it:



/usr/libexec/PlistBuddy -c "Print :menuExtras:" ~/Library/Preferences/com.apple.systemuiserver.plist


And remove it with something like:



/usr/libexec/PlistBuddy -c "Delete :menuExtras:3" ~/Library/Preferences/com.apple.systemuiserver.plist


However, I think managing the menubar with a Config Profile is going to be the best route to take since you'll have better control between reboots and such.


Actually, yeah, that's not a bad way to go about it you want to stick with a script. You can figure out the dynamic location of where in the array the icon is (and then subtracting one from the result) with something like this:



APIndex=$(/usr/libexec/PlistBuddy -c "Print :menuExtras:" ~/Library/Preferences/com.apple.systemuiserver.plist | grep / | grep -n AirPort | sed 's/://' | awk '{print $1-1}')


And then remove by using:



/usr/libexec/PlistBuddy -c "Delete :menuExtras:$APIndex" ~/Library/Preferences/com.apple.systemuiserver.plist

Thanks guys!


Edit: This mobileconfig solution still works in 10.12:
https://github.com/gmarnin/Profiles/blob/master/Airport%20Menubar%20Disable.mobileconfig






At the risk of thread necromancy, it looks like 10.12 doesn't list the top icon entries in the com.apple.systemuiserver.plist anymore. Does anyone know where they ferreted them off to?



Thank you!


@cornwella



Which preference domain did you place that in? I'm having a hard time getting that method to work.


Hi @echalupka,



we placed it in Computers -> Configuration Profiles, where it's defined as a Custom Payload.
The end result looks like this:




Is this configuration profile working for you in 10.13? I can't make it work and also my old configuration profile no longer works.
for domain com.apple.systemuiserver.ByHost



dontAutoLoad=[/System/Library/CoreServices/Menu Extras/AirPort.menu, /System/Library/CoreServices/Menu Extras/Bluetooth.menu, /System/Library/CoreServices/Menu Extras/TimeMachine.menu


going to add the script command to my firstrun script and see what happens...


Hey there, just found this thread now. Wondering if some version of this ended up working for you, and if you have any more details about how you implemented? Thanks very much for any advice. 🙂


This worked for me.


@jchen1225 does it still work for you? it doesn't work for me on Monterey !=


@jchen1225 does it still work for you? it doesn't work for me on Monterey !=


Still works for me it seems, though not always consistent. Sometimes it disappears after a reboot/logout. I'd try re-pushing the profile.


Does this still work for Mac OS 12.6.1?


Does this still work for Mac OS 12.6.1?


yeah it should still work on Monterey


I got it to work.

 

Thank you!


FYI, because this post always seems to come first in a Google of this problem, and didn't work for me: the solution has changed with the latest OSX. The location of the setting has changed. The domain is now:

com.apple.controlcenter

 

Plist is: 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>WiFi</key>
<integer>8</integer>
</dict>
</plist>

Solution was found here: REMOVE WiFi icon in Sonoma 


Reply