I stumbled across this useful little tidbit of knowledge. Have you ever needed to log into several machines in a lab but hated going to each one and typing in your credentials. Well thanks to “David Kahn3″ and others for coming up with the following script,
osascript <<EOF
tell application “System Events”
keystroke tab
keystroke (ASCII character 8 )
keystroke tab
keystroke (ASCII character 8 )
keystroke return
delay 0.5
keystroke tab
keystroke “username”
keystroke tab
delay 0.5
keystroke “password”
delay 0.5
keystroke return
keystroke return
keystroke return
keystroke return
end tell
EOF
I was able to push this script out using Apple Remote Desktop (run as root not admin) to my macs while they were at the login screen window. Just a few changes for the account username/password fields and bam the computers logged in without me having to even touch them.Beautiful

Michael in Greensboro, NC