Remotely log in user to multiple Macs

wangl2
Contributor

If I have a class of iMacs, is there a command way or using Apple Remote Desktop, that I can remotely log in all iMacs at once using the same user. The iMacs already have the users created of course. Our iMacs don't have automatically log in enabled. Students can also log in using their individual AD logins.
But sometimes, I would like to log them all in using a same local accounts and quickly show things to the students. Once logged in, I can use Apple Remote Desktop to bring up the same App.
Thanks.

7 REPLIES 7

yan1212
Contributor

Hey @wangl2

I haven't done this since....2005 so no guarantee it still works!

If you have to use Apple Remote Desktop for this then you can try osascript. Send the following as a remote UNIX command (editing the "username" and "password" fields to match your local account. The Macs need to be sitting quietly at the login window so you may want to restart before that.

osascript <<EndOfMyScript
   tell application "System Events"
       keystroke “username”
       keystroke return
       delay 3.0 
       keystroke “password”
       delay 1.5 
       keystroke tab
       keystroke return
       keystroke return
   end tell 
EndOfMyScript

Hope this helps.

PAC
Contributor

I get Syntax errors when i run it.

chriscollins
Valued Contributor

@wangl2 If the goal is just to visually demonstrate to the students something, have you thought about just using ARD's share screen feature where you can broadcast YOUR screen to all of their machines?

grecopj
Contributor

I use the following command within ARD sending a unix command. Make sure you run as Root as well.

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

I do get the follwoing error in ARD, but it completes and logs me in.

2017-01-11 12:39:39.305 osascript[1211:8055] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data

wangl2
Contributor

19635578425a4df9bc5c41dbedbcead0
Thanks for getting back. I am not really good with command or scripts so I just copied the whole thing into ARD Unix Command windows. After I run it as root, I received the following error and it didn't log in.
53:54: syntax error: Expected “given”, “in”, “of”, expression, “with”, “without”, other parameter name, etc. but found unknown token. (-2741)

I have problem with our Office 2016 Volume License Key, each iMac still requires to be activated by going to Internet even they are deployed with the key. So I was thinking to log in all machines using local admin account once and use the ARD to bring the Word to activate.
Thanks again.

dkramer11
New Contributor

wangl2, I had the exact same errors come up. I was able to figure out the difference between my code that worked and the code that my coworker emailed me.
Check your quotation marks around the username and password, as mine switched from end quotes to beginning quotes through the copying & pasting from an email.
You may have to manually type in the quotation marks to get it to work. Then save a template of your command code if it does work.

skinford
Contributor III

Great post,

I have to log in to labs after running the High Sierra update because it needs to run about another 10 minutes of installation stuff. Is there a way not using ARD that will allow you to log in after the High Sierra update is complete? Some type of a script?

Thank you in advance?