There are a few posts on this site that shows how to script the switching of a user from a Logged in account. However, I need to script the login process after a reboot.
Here’s my situation. I have a few Macs all which require a password at boot. (Entering a boot password is a requirement from IT.) While the computers sit at the Login Window, I need to send a remote event of some kind from Apple Remote Desktop, or anything else, that will enter the computer’s password and hit return.
If I try to send a UNIX command via Apple Remote Desktop to a computer sitting at the Login Window, I get the error ‘A console user is not logged in.’
If I try to send the Apple Remote Event ‘tell application “System Events” of machine “eppc://x.x.x.x” to keystroke “password”’, I get the error ‘Application isn’t running.’
Does anyone have an idea about how I can enter a password into the Login Window after a reboot? Or, is there anyway to send commands to System Events as well as get it to launch after a boot but while waiting on Login credentials?
Rob
Using ARD, this is what I do:
if [[ "$(/usr/bin/who | /usr/bin/grep console)" == "" ]]; then
osascript <<EndOfMyScript
tell application "System Events"
keystroke "guest" -- UserName
keystroke tab
delay 3.0
keystroke "guest" -- PassWord
delay 3.0
keystroke return
keystroke return
end tell
EndOfMyScript
fi
Thank you applebit! It works great for me!
FYI: The Login Window is running under root so in Apple Remote Desktop (ARD) you have to put the user as “root”.
The other issue I had was that my Macs have the same username but different passwords. I’ve been using a text file ~/loginpass.txt to store the password on each computer. Fortunately, the password never changes and I can issue ARD commands like:
I took applebit’s code and included my password file:
Comment to self: Maybe I should have put the if statement higher…
This will work on most of the computers the first time. A few of the computers will require this command to be sent a second or third time because the login window prompt is not always where you expect.
If you have different user names and different passwords on each computer, then I’m sure you can incorporate that information into your loginpass.txt file.
Rob Stokes
ASSURED SOLUTIONS
Emergency Help Line: 214-747-9911
Information/Report Line: 214-747-4411
http://www.idigmedia.com
http://www.remotearchiving.com
“Helping our clients increase productivity through measured performance.”