Posted on 04-03-2017 03:53 PM
I have a really simple script that is suppose to run when the user logs into the computer to set the computer name. However even through the log file says it runs, it doesn't show up on the client machine.
I have tried jamf manage and jamf update but no go.
Any suggestions to get it working?
Posted on 04-03-2017 05:09 PM
Would it be because it is running as root and the end user never sees the prompt? Make sure you are running as the logged in user.
I am using cocoadialog to do a similar thing but making sure it is running as the current logged in user. Not sure how you would do that in Apple Script but im sure you can google it
Posted on 04-03-2017 06:22 PM
Applescript should display for the currently logged in user regardless.
I don't think you need to tell "System Events" either just go straight to the dialog
#!/bin/sh
assignment=$(osascript<<END
set assignment to the text returned of (display dialog "Please Enter Computer Name" default answer "")
END)
echo $assignment
Posted on 04-03-2017 06:24 PM
hmm, this is something I might have to look into if it always picks up current logged in user.
Posted on 04-03-2017 08:48 PM
@BOBW That definitely how it behaves on a few Self Service policies I have.
Posted on 04-04-2017 12:58 PM
Yeah @Look it should and had in the past when it was first introduced to me but now it is not working while it works in self-service it doesn't in login hooks.
Posted on 04-04-2017 03:51 PM
@anickless I think that might be a function of 10.11 and 10.12, I had to adjust a few of my login scripts that used Applescript to activate a little later in the login process for them to work correctly (not dialogs but other functions), I think 10.12 especially has change the order or how long some of the login items take.
I generally divorce the contents of the script away and then have it wait for the finder to fully load before attempting the tasks.
Posted on 04-04-2017 03:52 PM
Doing some testing and found out the issue is isolated to touch bar macbook pros. Still frustrated by how it is not hooking at login :(