Unable to use the unix command in ARD to log in as one user on multiple computers running Mojave

annnnnieb
New Contributor

I normally run this script when trying to log into multiple computers via Apple Remote Desktop:
osascript -e 'tell application "System Events"' -e 'keystroke "username"' -e 'keystroke tab'
-e 'delay 0.5' -e 'keystroke "password"' -e 'delay 0.5' -e 'keystroke return' -e 'keystroke return' -e 'keystroke return' -e 'keystroke return' -e 'end tell'
When I try to run this script on computers running Mojave I get the error:
execution error: System Events got an error: osascript is not allowed to send keystrokes. (1002)

9 REPLIES 9

sshort
Valued Contributor

The Mac receiving the commands probably needs a PPPC profile that whitelists osascript to control System Events via AppleEvents, and accessibility (for the keystroke).

https://www.jamf.com/jamf-nation/articles/553/preparing-your-organization-for-user-data-protections-...

wesleya
Contributor

That might work, but I thought Mojave dropped support for running scripts like these at the login window.

zinkotheclown
Contributor II

78908b53c82446128f562862e959c34c
I got this to work in Mojave by using a PPPC config profile for ARDAgent.

Randydid
Contributor II

Thanks @zinkotheclown you have no idea how much time you just saved me and my team!

rcole
Contributor

Has anyone been able to get this to work during the log in screen in Big Sur?

+This! Any fix for Big Sur?

Luke_cater
New Contributor II

Yes I manage to get it working by doing the following 

1. If you have a Restrictions Config Profile make sure Allow AirPlay, View Screen by Classroom, and Screen Sharing (macOS 10.14.4 or later, enrolled via a PreStage enrolment) is checked under the Functionality tab.

2. Create a PPPC 

ARD Agent can be found in /System/Library/CoreServices/RemoteManagement/ARDAgent.app >Allow System Events and Accessibility 

Script Editor > Allow  Accessibility 

 

rcole
Contributor

Anyone able to get this to work using Monterey? If so, are you using a PPC?

zinkotheclown
Contributor II

The PPPC profile no longer works on newer macOS's starting with Catalina.  You have to enable RDC with a management command in Jamf. 
https://community.jamf.com/t5/jamf-pro/enabling-remote-desktop-on-catalina/m-p/224293