Terminal wants access to control System Events.

Eskobar
Contributor

 

Hello,

I need to prompt users with "osascript"
even admin rights granted, popup not showing up on some macs only !!!

Capture d’écran 2023-06-05 à 15.18.41.png

instead, they got this:
y.png
Any idea please?
2 REPLIES 2

sdagley
Esteemed Contributor II

@Eskobar That implies that for Macs which are not displaying that prompt you have previously deployed a Configuration Profile with a  PPPC profile granting access to System Events. Look at your Configuration Profiles for one with that PPPC profile and see why it's not being deployed to the Macs where that prompt is appearing

Bol
Valued Contributor

@Eskobar 
There's no need for a 'Tell' block when using the apple script command 'display dialog' so remove that.

Also osacript doesn't need to send a command to another process (system events) which causes the privacy prompt, remove that too. 

Lastly running osascript in the user context is enough, unless you are doing more than just a dialog box you can remove adding them to admin group.

So it would look like;

sudo -u $user /usr/bin/osascript -e "display dialog....." etc.

Good luck!