plugsandpixels

Q: Mass login via ARD (need current UNIX script)

I need to mass log in to multiple lab computers to do individual work with them at the Desktop using ARD 3.7.1. Old UNIX scripts posted elsewhere on the forum no longer work with more recent versions OSX (I am running 10.8.5). I get a "Succeded" when nothing actually happened (the computer remains at the login screen). In the past I would be taken to the desktop after running the script.

 

For example:

 

osascript <<EOF

tell application "System Events"

keystroke "<username>"

keystroke tab

delay 0.5

keystroke "<password>"

delay 0.5

keystroke return

keystroke return

end tell

EOF

iMac, OS X Mountain Lion (10.8.5)

Posted on Jan 14, 2014 1:58 PM

Close

Q: Mass login via ARD (need current UNIX script)

  • All replies
  • Helpful answers

  • by plugsandpixels,

    plugsandpixels plugsandpixels Jan 14, 2014 1:58 PM in response to plugsandpixels
    Level 1 (10 points)
    Jan 14, 2014 1:58 PM in response to plugsandpixels

    UPDATE:

     

    Restarting all computers with ARD and re-running the script proved successful.

  • by chicster,

    chicster chicster Jan 14, 2014 3:13 PM in response to plugsandpixels
    Level 2 (204 points)
    Mac OS X
    Jan 14, 2014 3:13 PM in response to plugsandpixels

    your actual issue might be related to previous complaints that in mavericks, the cursor is not reliably in the "name" field on logout or coming out of sleep. Not really sure of all the criteria.  Am pretty sure that on initial start up it is in the name field.  Which may mean that is why the script worked on restart.

     

    I have been using that script with mavericks and it works fine  -- IF the cursor is in the name field.  Which is always the way it has been. Also, it has always been you will get a "succeeded" even if it was not in the name field and thus not logged in.

  • by plugsandpixels,

    plugsandpixels plugsandpixels Jan 14, 2014 3:17 PM in response to chicster
    Level 1 (10 points)
    Jan 14, 2014 3:17 PM in response to chicster

    Interesting, thanks! On some non-lab computers (including those with Mavericks) I have seen the cursor not already in the password field and had to manually move it.

  • by Daniel Ball,

    Daniel Ball Daniel Ball Mar 7, 2014 7:52 AM in response to plugsandpixels
    Level 2 (230 points)
    Mar 7, 2014 7:52 AM in response to plugsandpixels

    Was also having this problem and forgot about it because I haven't used it and some people on Macenterprise forums posted the fixes, the top two lines are added for the problematic OS's like Mt Lion, etc.

     

    osascript -e 'tell application "SecurityAgent" to activate'; \

    osascript -e 'tell application "Bluetooth Setup Assistant" to quit'; \

    osascript -e 'tell application "System Events" to keystroke "yourUsername"'; \

    osascript -e 'tell application "System Events" to keystroke tab'; \

    osascript -e 'tell application "System Events" to delay 0.5'; \

    osascript -e 'tell application "System Events" to keystroke "yourPassword"'; \

    osascript -e 'tell application "System Events" to delay 0.5'; \

    osascript -e 'tell application "System Events" to keystroke return'

  • by imissapplecomputer,

    imissapplecomputer imissapplecomputer Mar 19, 2014 4:27 AM in response to Daniel Ball
    Level 1 (1 points)
    Mar 19, 2014 4:27 AM in response to Daniel Ball

    Just tried this in one of my labs (all are running 10.9.2) and, sad to say, the machines are still sitting there with NO cursor in the name field--and no machines logged in. 

     

    At least ARD is telling me the command was successfully sent.  I suppose that counts for something--if warm fuzzy feelings count as successful lab management.

  • by Daniel Ball,

    Daniel Ball Daniel Ball Mar 19, 2014 11:18 AM in response to imissapplecomputer
    Level 2 (230 points)
    Mar 19, 2014 11:18 AM in response to imissapplecomputer

    Works fine here for 10.8.x clients and I have one 10.9.2 client I test with and others use it off the mailing list.

  • by imissapplecomputer,

    imissapplecomputer imissapplecomputer Mar 19, 2014 11:40 AM in response to Daniel Ball
    Level 1 (1 points)
    Mar 19, 2014 11:40 AM in response to Daniel Ball

    Oh, I have no doubt or complaints about  suggested log in scripts working in 10.8.x.

     

    Or 10.7.x.

     

    Or 10.6.x.

     

    Or 10.5.x.

     

    Or even 10.4.x (although I think some of them have evolved since then).  We've been using them for over 10 years to do all sorts of cool, easy, awesome lab maintenance/deployment.

     

    But they DON'T WORK IN 10.9 ON MY 100 MACHINES.

     

    I'm happy that people have solutions for their labs running 10.not9.  If I could, I'd switch my labs back to pre-10.9 days and be happy as a clam.  But I can't.

  • by Daniel Ball,

    Daniel Ball Daniel Ball Mar 19, 2014 12:38 PM in response to imissapplecomputer
    Level 2 (230 points)
    Mar 19, 2014 12:38 PM in response to imissapplecomputer

    Its working fine here with my one 10.9.2 client.  Should be the same between 10.8.x and 10.9.x.

     

    What happens if you just send the first line to a client?  Does it enable the cursor?

     

    osascript -e 'tell application "SecurityAgent" to activate'; \

     

     

    Anyone else tested the full script with 10.9.x clients?  Working or not working?

  • by chicster,

    chicster chicster Mar 22, 2014 10:53 AM in response to Daniel Ball
    Level 2 (204 points)
    Mac OS X
    Mar 22, 2014 10:53 AM in response to Daniel Ball

    I did the first thing - just sent the security agent line to 10.9.2 clients from 10.9.2 computer running 3.7.2 admin and worked exactly as expected - made the cursor appear in the Name box.   Then I ran the script I have always used to login and it worked as expected. 

     

    Then I adapted the line into my script (which is in a little different format) and that worked fine also.  So could go from a client with no cursor showing to logged in with one unix command using 3.7.2 to a 10.9.2 client. 

  • by Annie B,

    Annie B Annie B Mar 25, 2015 2:42 PM in response to Daniel Ball
    Level 1 (90 points)
    Mar 25, 2015 2:42 PM in response to Daniel Ball

    I have tested the script with Yosemite and it works great. Thanks, it makes life easier in the lab environment.

  • by jlg47331,

    jlg47331 jlg47331 Dec 11, 2015 5:38 AM in response to plugsandpixels
    Level 1 (8 points)
    Notebooks
    Dec 11, 2015 5:38 AM in response to plugsandpixels

    I am in a similar situation with the Macs in my journalism lab. They are all set to open into the screen showing users rather than the name/login field. Do I need to change the login options to make this script work?  Thanks!

  • by tderoche,

    tderoche tderoche Dec 17, 2015 12:29 PM in response to Daniel Ball
    Level 1 (4 points)
    Mac OS X
    Dec 17, 2015 12:29 PM in response to Daniel Ball

    So, I had problems in my 10.9.5 lab with both scripts. After a little tinkering with the second posted script I came up with the following which works for me:

     

    osascript -e 'tell application "SecurityAgent" to activate'; \

    osascript -e 'tell application "Bluetooth Setup Assistant" to quit'; \

    osascript -e 'tell application "System Events" to keystroke "<username>"'; \

    osascript -e 'tell application "System Events" to keystroke return'

    osascript -e 'tell application "System Events" to delay 0.9'; \

    osascript -e 'tell application "System Events" to keystroke "<userpassword>"'; \

    osascript -e 'tell application "System Events" to delay 0.9'; \

    osascript -e 'tell application "System Events" to keystroke return'

     

    I'm not a scripter so not sure why this works and not the original. I kept getting an error about the 'tab' part I think so I got rid of that. I thought my lab might be slower so I added more delay. Anyway, hope it helps those for whom the other ones don't.