When importing an 802.1x system wireless profile, anybody know a way to make it go to the top of the preferred networks list? By default it seems to be putting it at the bottom of the list. I know how to remove it by running 'networksetup -removepreferredwirelessnetwork' but putting it back into the list seems to be more of a challenge.
So question, does this script interrupt the network connection as it sets a priority? IE does it take you offline and then back online?
Gabe Shackney
Princeton Public Schools
@gshackney It shouldn't
Any word on this working with Big Sur?
@luke.reagor I have it running on both Big Sur 11.3.1 and Catalina 10.15.7 (with native/old Python 2.7)
This script doesn't handle missing SSIDs. Example:
I populated the variables (The 'PreferredSSIDs' array) with fake (non-existent) SSIDs, and the script exits cleanly as if it actually moved the bogus SSIDs up/down in the 'Preferred Network' list. Has anyone else tested this?
Has anyone added logic to verify the target SSID(s) and exit with an error if the SSIDs aren't in the 'Preferred Network' list? Example:
Example: “Error: The SSID ‘preferred_SSID’ was not located in the Preferred Networks list.”
Note: I'm using Mike Lynns original script version (https://gist.github.com/pudquick/fcbdd3924ee230592ab4#file-reorder_wifi_alt-py)
Also a reminder to those using 802.1x for Wi-fi: Don't use the networksetup tool in a shell script to add/delete SSIDs to manage your 'Preferred Network' SSID list, as it may break your corporate 802.1x settings and/or Keychain cert entries. Use python (like the script above) that can make macOS API calls to move the SSIDs order in the list.
Does anyone have a solution that works with networks labeled as WPA2/WPA3 Enterprise? `networksetup` only seems to support up to wpa2e, and while I am able to connect to a WPA2/WPA3 Enterprise network if it's added back as WPA2 Enterprise, it doesn't seem like a good idea to be changing the security when adding the network back.
I had been using the python script linked above (by sdagley in 2017) and it works, but I'm trying to move away from python since in 12.3 it won't be part of macOS. I tried converting the script to python3 but got hung up on the line:
`return collections.namedtuple('AttributedFramework', loaded_classes.keys())(**loaded_classes)`
From what I could find, in python3 loaded_classes.keys() includes items that start with _ (underscores), while with python2 running the same command doesn't. The problem seems to be namedtuple doesn't play well with underscores, but I don't know enough about python3 to figure out how to account for it. It's also possible there'd be problems down the line with other parts of the script, but I can't get past that.
I'm using the macadmins python3, so it's able to import all the modules at the top of the script (that may not be the case for other python3 packages).
I found a solution for python3, based off https://gist.github.com/pudquick/fcbdd3924ee230592ab4. Check the comments for the changes that need to be made to the script for python3.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
