I am relatively new to Macs and their osascript syntax. I have a mac mini set up as a server and I am trying to use Apple Remote Desktop to send a command to one of the iMac workstations. When I send the command osascript -e 'tell application "System Events" to shut down' I get the message execution error: File permission error (-54). I am unsure how to resolve this. Any help would be greatly appreciated!
-
1I'm no expert on ARD, but I have a feeling you're hitting Gatekeeper... system prefs>security & privacy>privacy which would need adding on that machine. Do you need to do this by script? There's a menu command under Manage to shut down the remote machine. – Tetsujin May 29 '19 at 8:45
-
I work in a school where we have a network of iMacs and a Mac Mini server. I need to be able to schedule the imacs power on and power offs from the mac mini server. I have gone to system prefs > security & privacy > privacy but am unsure to what settings is it I need to alter, sorry! – Dan W Chancellors May 29 '19 at 9:42
-
tbh, it's the kind of thing I'd send to the nearest machine & go look. I don't really know specifically what event it would raise, sorry. Someone's bound to come along later who can tell you more - wish you luck :) – Tetsujin May 29 '19 at 10:00
If you want to run sudo command with ARD select run command as User and written root.
Edit : It doesn't have to go through the osascript to turn it off. A shutdown -h now
with root user is enough
You can also shutdown the station via the Manage menu
-
yeah I tried this before using the sudo command which did not work but running as root without the sudo command did the trick, as you pointed out here. Thank you! – Dan W Chancellors May 30 '19 at 8:19