script "connect" button in network preferences

perryd
Contributor

I'm hoping this is really easy and someone will know, but I've searched high and low and can't find a command to automate the "connect" button in network preferences.
Does anyone know the command to control it?
I'm basically switching networks with;
networksetup -setairportnetwork en0 MYNETWORK
but then it needs someone to click on "connect" or it just sits there doing nothing.

f9ebfabdc84b4629aa69dd77ef3e53e7

3 REPLIES 3

perryd
Contributor

Anyone?

maurits
Contributor

depending on the network, you may have to give consent to use the computer certificate (in my case) for 802.1x access.
That is hard (or impossible?) to script. I have my users approve to use this cert once (part of onboarding manual) and afterwards the wifi auto-connect settings take care of automatically connecting to the 802.1x network.

perryd
Contributor

Thanks for the reply @maurits

We have the same set up, once it's approved it just works. So if the user manually selects different wifi and then comes back to the domain wifi it just switches no problems. It's when I use a script to switch the network that it seems to require this connect button to be clicked.

Driving me mad!!!