We have an osa script that prompts for the machine names (country, location, asset tag, etc), then combines the entries to the machine name. it works fine as a self service script individually or through our DEP process (again a SS workflow).
However when I run it through a policy, the first couple prompts error out but the last few work fine.
I've tried adding a sleep function to it, but it didn't seem to help.
Below is the verbose bash output that was uploaded to the JSS logs (machine name was <scrubbed>).
I've tried making it the 1st or 2nd policy run, but it didn't seem to matter.
Executing Policy 01 Prompt for Computer Name
Running script #Prompt for Computer Name.sh...
Script exit code: 0
Script result: + sleep 10<br/>
++ /usr/bin/osascript<br/>
38:46: execution error: An error of type -10810 has occurred. (-10810)<br/>
+ COUNTRY=<br/>
++ /usr/bin/osascript<br/>
38:46: execution error: System Events got an error: Application isn’t running. (-600)<br/>
+ REGION=<br/>++ /usr/bin/osascript<br/>+ MODEL=<scrubbed><br/>
++ /usr/bin/osascript<br/>
+ TAG=<br/>
+ ComputerName=<scrubbed><br/>
+ echo ushofml65432<br/>
<scrubbed><br/>
+ scutil --set HostName <scrubbed><br/>
+ scutil --set LocalHostName <scrubbed><br/>
+ scutil --set ComputerName <scrubbed><br/>
+ echo Rename Successful<br/>
Rename Successful<br/>