05-09-2022 11:03 PM - edited 05-09-2022 11:04 PM
Has anyone had any success in disabling WiFi and the WiFi menu. Configuring our Monterey build for our labs environments.
Have found a script to disable WiFi but struggling to disable the WiFi menu.
Have found a few config profiles on here but can't seem to get them working. I think there for older version off OSX.
A config profile would be ideal if anyone is able to help.
It would need to work on both intel and M1 Imacs.
Posted on 05-10-2022 03:47 AM
I use these two to sort that out, but if the menu bar is set to display the status, then it still will, it will be greyed out.
Not tried a config profile for it yet. It works with 12.3.1, but as with anything Test, Test and Test again.
# Turn Off WiFi
/usr/sbin/networksetup -setairportpower airport off
# Disable the Wifi service
networksetup -setnetworkserviceenabled Wi-Fi off
When you go into the System Preferences, and Network. WiFi will be showing as inactive.
Swapping the "off" to "on" will reverse the changes.
Posted on 05-10-2022 05:11 AM
thanks @PaulHazelden there does'nt seem to be nice way to remove menu bar.
do you know if networksetup has a way to hide it instead?
Posted on 05-11-2022 01:36 AM
From what I can work out, it isnt in networksetup. Its in com.apple.systemuiserver, but its in an array and can get messy to fix because it can be in different locations in the array.
I found some stuff on it, but from a long time ago, think High Sierra long time ago. Not sure any of that will be relevant. They were using the defaults command to then deal with the array, and then kill the systemUIServer.
I just live with it as it is. If I remember when I am logged in to the Macs, I turn it off manually. Once the service is inactive, you need an administrator to turn it back on again.
Posted on 05-12-2022 07:55 AM
From Big Sur up it’s the com.apple.controlcenter you should be looking at.
Just run sudo -u $currentUser defaults -currentHost write com.apple.controlcenter WiFi -int 8 to hide it and 2 to show it back, either from Execute Command or a script (just set currentUser var with stat or scutil). Of course it won’t work if no one’s logged in, so account for that. If it doesn’t get you the effect immediately (it should), killall ControlCenter 👍
05-12-2022 08:05 AM - edited 05-12-2022 08:08 AM
What would that look like on Monterey or this would work on this version of OSX also.
Posted on 05-12-2022 08:14 AM
Same. „From Big Sur up” says it all, I suppose 😉.
Of course I’m sure someone will read this in 2030 and prove me wrong 🤣.
Posted on 07-25-2022 09:04 PM
Posted on 07-26-2022 04:30 AM
Hi, Not something I have done.
Will give you the names of all of the services, in the order they are set to be used. And for me the Ethernet is called "Ethernet"
networksetup -setnetworkserviceenabled Ethernet off
Would be the command to use to disable the Ethernet connection, Put on at the end to turn it back on.
Will give you a full list of the commands and how to use them.
You might have to use sudo in front of the commands as some will require root access to run.
As with everything Test it several times in your setup before sending it out into production.
Posted on 07-26-2022 04:16 PM
Thank you so much bro!
Will try this out
Posted on 10-17-2022 07:37 AM
Could you show me how you worked this out? Script or config profile. I see a lot of responses and was wondering what worked for you.
Posted on 12-13-2022 05:57 AM
Is there a configuration profile anywhere for com.apple.controlcenter to hide the Wi-Fi icon? I was trying with iMazing Profile Editor but it doesn't seem to support this option? Does anyone have a plist or mobileconfig they can share?
Posted on 02-15-2023 01:18 PM
networksetup -setairportpower en0 off (turns off WiFi)
networksetup -setnetworkserviceenabled Wi-Fi off (disables WiFi adapter so in Control Centre it indicates its not configured)
As an admin
networksetup -setairportpower en0 on (turns on WiFi)
networksetup -setnetworkserviceenabled Wi-Fi on enables WiFi adapter