Skip to main content
Solved

Mojave and Higher: Set WiFi inactive via terminal command.

  • September 24, 2019
  • 4 replies
  • 5 views

Forum|alt.badge.img+8

So I open the network prefs, select the wifi interface go to the little cog wheel at the bottom and select "Make Service Inactive".

Can somebody please tell me how to do this via the Terminal, or at least a script that I can push out via jamf or something?

Oh, it needs to work on Mojave and higher macOS...

Best answer by Jookyseacap

@MagicMick I use the same commands in a script triggered by a LaunchDeamon as @clearyma and it makes the Wifi Inactive. The first command turns the wireless off and if you stop there users can just turn the wireless back on if desired. The second command of -setnetworkserviceenabled makes the wifi card inactive. From my experience that does not always show in menu bar GUI right away, but it does show in the network pref pane, also if a user tries to turn the wireless back on it won't work and then the wireless icon will change to the disabled icon.

View original
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+5
  • New Contributor
  • 9 replies
  • September 24, 2019

I created 2 scripts, distributed via policy to a smart group for everything that isn't a MacBook. It's worked perfectly for all our Macs, which range from 10.11-10.14. And if you want to re-enable wifi you can just change off to on.
networksetup -setairportpower Wi-Fi Off
networksetup -setnetworkserviceenabled Wi-Fi Off


Forum|alt.badge.img+8
  • Author
  • Contributor
  • 63 replies
  • September 24, 2019

Thanks, but that's not the same.

That is turning wifi on/off... I really need to set the service inactive.

The commands you gave me allow non-admin users to enable the wifi settings. I need to have them restricted.

But I do appreciate the efforts!


Forum|alt.badge.img+10
  • Contributor
  • 16 replies
  • Answer
  • September 24, 2019

@MagicMick I use the same commands in a script triggered by a LaunchDeamon as @clearyma and it makes the Wifi Inactive. The first command turns the wireless off and if you stop there users can just turn the wireless back on if desired. The second command of -setnetworkserviceenabled makes the wifi card inactive. From my experience that does not always show in menu bar GUI right away, but it does show in the network pref pane, also if a user tries to turn the wireless back on it won't work and then the wireless icon will change to the disabled icon.


DWilliams-cmsd
Forum|alt.badge.img+3

Glad I found this thread.  The two lines of script provided by @clearyma work perfectly on my machines for first turning off then disabling Wi-Fi.  I'm deploying them in a scrtipt payload via policy to desktop machines that we want to keep on ethernet.  This keeps end users from connecting their desktops to our guest WiFi and losing access to on-site resources.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings