Reordering Preferred Wireless Networks

mostlikelee
Contributor

We're pushing out a wireless configuration profile which adds the new wireless network to the bottom of the preferred wireless network list. We're looking to get it to the top, but the networksetup command only allows us to:

-addpreferredwirelessnetworkatinded (adds the network manually, which wont work since we are already using the config profile which includes SCEP)

-removeallpreferredwirelessnetworks (not a fan of removing all before distributing the config profile, besides most config profiles are already distributed)

Anyone out there have luck with reordering existing preferred wireless networks?

-Tim

8 REPLIES 8

jacob_salmela
Contributor II

You could try something like this:
networksetup -addpreferredwirelessnetworkatindex <device name> <network> <index> <security type> [password]
Put the network Enterprise-Network in the first position (indexing starts at zero) using no security

networksetup -addpreferredwirelessnetworkatindex en1 Enterprise-Network 0 None

Put the network Guest-Network in the second position, using WPA2 with password, password

networksetup -addpreferredwirelessnetworkatindex en1 Enterprise-Network 1 WPA2 password

andrew_stenehje
Contributor

I ran into a similar need and ended up having to fully remove an preferred network that was taking precedent if it had been added before the new one. Maybe you could remove the one, add the one with higher priority and then add the second network?

mostlikelee
Contributor

Thanks guys,

@jacob_salmela, the -addpreferredwirelessnetworkatindex doesn't work for us because we already have the wireless config in a configuration profiles bundled with a scep payload. Running the command after the config profile is installed errors in "wireless_network is already in the preferred networks list".

@andrew_stenehjem, unfortunately our users have unknown preferred networks we can't remove

jacob_salmela
Contributor II

I see that you said that to begin with; I must have read your post too fast. Yeah, the only way I can think is to remove it first, but sounds like that is not an option...

Hafiz
New Contributor II

@mostlikelee We have the same exact same problem. Did you find a solution to this?

Hafiz
New Contributor II

What I don't understand is that in Configuration Profiles there is no way to push the priority of a Wireless network payload (WPA2 Enterprise, PEAP) to the top of all our MacBooks.

So basically they (the MacBooks) will pull the Config Profile for the WPA2 Enterprise wifi network and then we will switch off the old wifi network. However, we would for a time like both in operation and have all the MacBook clients work on the preferred WPA2 Enterprise one BUT there does not seem to be any way to do that.

FritzsCorner
Contributor III

There is another thread I posted in with Apple's suggested method. I have not tested this so I can't say if it works or not.

https://jamfnation.jamfsoftware.com/discussion.html?id=18223t

Sanchi
Contributor

Hey guys, this worked for me:

https://gist.github.com/pudquick/fcbdd3924ee230592ab4

Found it on this thread:

https://jamfnation.jamfsoftware.com/discussion.html?id=18223