Skip to main content
Question

login script troubleshooting


anickless
Forum|alt.badge.img+9

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?

7 replies

Forum|alt.badge.img+8
  • Valued Contributor
  • 126 replies
  • April 4, 2017

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


Forum|alt.badge.img+16
  • Valued Contributor
  • 1002 replies
  • April 4, 2017

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

Forum|alt.badge.img+8
  • Valued Contributor
  • 126 replies
  • April 4, 2017

hmm, this is something I might have to look into if it always picks up current logged in user.


Forum|alt.badge.img+16
  • Valued Contributor
  • 1002 replies
  • April 4, 2017

@BOBW That definitely how it behaves on a few Self Service policies I have.


anickless
Forum|alt.badge.img+9
  • Author
  • Contributor
  • 87 replies
  • April 4, 2017

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.


Forum|alt.badge.img+16
  • Valued Contributor
  • 1002 replies
  • April 4, 2017

@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.


anickless
Forum|alt.badge.img+9
  • Author
  • Contributor
  • 87 replies
  • April 4, 2017

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 :(


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings