Remote GUI Login

By: Richard Glaser, University of Utah - Revised: 2007-10-30 richard


There are times in educational or other environments, you might want to quickly login a group of Mac's like in a classroom in situations where attendee's might not be affiliated with the university and be using temporary guest accounts.

You can use Apple Remote Desktop's, Send Unix command to accomplish this task.

Send Remote GUI Login Script

Next, you want to send the following unix command to the clients using Apple Remote Desktop

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

In the above script example, you want to replace "username" with the account name, and "password" with the account password.

The "osascript" is a command to execute AppleScripts from the command line. "System Events" is used to provide GUI scripting and enter in particular keystrokes (i.e. username & password) and the tab & return keys.

System Events is a faceless application that supplies the terminology for using a number of features in AppleScript scripts. Among these features is GUI scripting, which allows your scripts to perform some actions in applications that have no built-in scripting support. System Events, which is located in /System/Library/CoreServices, has been part of Mac OS X since version 10.1.

Apple Remote Desktop - Send UNIX Command - Remote GUI Login

Once, the clients have completely logged in, you can perform other actions with Apple Remote Desktop, like copying files to the client, etc.

Apple Remote Desktop - Copy Items

Lastly, I would recommend saving this script as a "Saved Task" and Apple Remote Desktop for quick access.