I am looking for a programmatic way to connect to a wifi network. It can be saved (remembered) or unknown, preferably in Apple Script or via Automator.
I have done this on a Windows PC through the following command:
netsh wlan add profile wifi.xml user=current
(creating it, as the only available wifi network, would attempt to connect to it)
The real problem I am having is: I have a Mac Book, OSX 10.10, shared by two users. One user should be able to access (and preferably connect by default) to SSID "Wifi1" and the second user should be able to access SSID "Wifi2", but neither user should connect to the other user's wifi. The Windows
netsh wlan with option
user=current accomplishes this but I don't see this being supported on a Mac.
Disabling SSID remembering, and having the users type the password in each time, would of course accomplish this goal but I'm searching for a more automated solution.
I have not found a way to accomplish this via preferences, wifi priorities, remembering networks, or anything else.
Also to note, Fast User Switching is enabled (this appears to make scripting difficult in my research because there is no reliable trigger or event to listen to for the script to run).