Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

ARD Login Script errors

I've been using this as a unix command to login a lab of computers for several years


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

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

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

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 "learn"'; \

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

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


and randomly get this error message back;


osascript[58392:3633525] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data (repeated 10+ times or more)


the login works, so just curious to know what might be causing this error.


This same question was asked a few years ago in this discussion https://discussions.apple.com/thread/7382301


With this as one suggested solution:


If that does not work, for the account your using to remote into the computer.

Log into the client. User Directory Utility to enable root

login to the computer as root

open system preferences Security & Privacy

click on privacy tab

click on accessablity

check SystemUIServer

When I follow these instructions there is no SystemUIServer to check.

iMac, 10.8.x - 10.11.x

Posted on Jan 10, 2018 8:53 AM

Reply
5 replies

Jan 10, 2018 12:48 PM in response to Richard Davis7

The root user is a user. The sudo commands shown switch to a different user; to the specified user, or to the current GUI console user.

sudo -u username {command}

sudo -u $(ls -l /dev/console | awk '{print $3}') {command}

In this case, {command} is the name of the shell script containing those osascript commands. If the script is in the file /Users/Foobar/myscript, then the commands would be:

sudo -u username /Users/Foobar/myscript

sudo -u $(ls -l /dev/console | awk '{print $3}') /Users/Foobar/myscript

Jan 10, 2018 5:59 PM in response to MrHoffman

I feel like we are not on the same page here. I am using a Unix command from the Apple Remote Desktop Admin app and sending this as root to machines that are at the login window. Not a script saved locally on the machine, which I suppose I could try. But this worked without any feedback or errors up to Os 10.10.x, then started showing the described feedback or error when the machines were upgraded to 10.11.x. I haven't notice if I get the same results on 10.12 or 10.13 machines, but will check tomorrow.


Fortunately, the login process still works on the 10.11.x machines. I was just curious about where or why I was now seeing the error above.

Jan 11, 2018 9:58 AM in response to Richard Davis7

Then send each command with the specified sudo, and see if that works?


I understand that this used to work for you, and that macOS has changed, and I know that security around the GUI has gotten upgraded for various reasons — processes running under different users and trying to access the GUI is not goodness from the perspective of security, unfortunately.

ARD Login Script errors

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.