Basilic

Q: add preferred wireless network

I want to setup preferred wireless networks on a pool of 25 computers in one go while no console/GUI/admin users are logged in, ie computers are started up waiting on the logging screen. All computers are correctly configured for "remote management" access.

 

I am looking for a trick in Apple Remote Desktop to add some preferred wireless networks with the terminal command "networksetup" to these remote computers

 

I have the terminal command right:

sudo networksetup -addpreferredwirelessnetworkatindex en0 ssid 0 wpa2 password

 

Any help?

MacBook Pro with Retina display, OS X El Capitan (10.11.6)

Posted on Sep 27, 2016 8:14 AM

Close

Q: add preferred wireless network

  • All replies
  • Helpful answers

  • by dwbrecovery,

    dwbrecovery dwbrecovery Sep 28, 2016 1:41 AM in response to Basilic
    Level 3 (584 points)
    Servers Enterprise
    Sep 28, 2016 1:41 AM in response to Basilic

    Hi Basilic,

     

    - A trick that should work can use the ARD Agent from the Admin Mac, to run ssh sessions through the ARD Agents on the clients, which then run the terminal command.

    - I used a script like this previously to restart locked up ARD Agents on clients via ssh.  No GUI sesssions were running on the clients.

     

    The Unix script in ARD would be similar to:

     

    for N in "client1.local" "client2.local" "clientn.local"

      do

    {

       ssh "$N" "sudo networksetup -addpreferredwirelessnetworkatindex en0 ssid 0 wpa2 password"

    }

      done

     

    - The script is run using an adminuser which is available on each client with ssh keys setup ( no password prompts ) and an entry in /etc/sudoers so the sudo command does not prompt for a password either.

    - The adminuser can be enabled for this task in a seperate scripts:

     

    Disable: chsh -s /usr/bin/false adminuser   

    Enable:  chsh -s /bin/bash administer     

     

    hope this helps, dwbrecovery