Displaying a Popup in Finder after Setup Assistant

bmarks
Contributor II

I am trying to create a popup that is displayed as soon as one of our provisioners gets to the Finder after going through a PreStage enrollment process. In our workflow, a provisioner creates the admin user as part of Setup Assistant. I have a policy that runs a script using jamfHelper to display a popup that I want the provisioner to see immediately. The "At enrollment" trigger doesn't seem to work because the popup ends up being displayed while still in Setup Assistant since it's a PreStage workflow. The "Login" trigger also doesn't seem to work since there's no actual login once Setup Assistant is complete.

I just can't seem to get the timing right with the popup.

For context, we deploy a config profile the activates FileVault during PreStage. We want the provisioner to log out to complete FV activation as the first thing they do, which is what the popup says (and with a "logout" button.) The rest of the workflow works great for us.

2 REPLIES 2

ThijsX
Valued Contributor
Valued Contributor

Hi,

Maybe you can start your script with below, and proceed with the DisplayDialogue.

#!/bin/bash

while true
do
loggedinuser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')

echo $loggedinuser

    if [ "${loggedinuser}" == "root" ] || [ "${loggedinuser}" == "_mbsetupuser" ]; then
    echo "is root or mbsetupuser"
    sleep 5
    else
    echo "is local user"
    break
    fi
done


proceed with your dialogue here

mainelysteve
Valued Contributor II

I had the same issue with a depnotify policy and the enrollment trigger. What did it for me was to add a dock checker in my script. I grabbed mine from a quick search on the Google machine, but I'm sure there are examples on here as well. I added the one I use below.

dockStatus=$(pgrep -x Dock)

echo "Waiting for Desktop..."

while [[ "$dockStatus" == "" ]]
do
  echo "Desktop is not loaded. Waiting."
  sleep 5
  dockStatus=$(pgrep -x Dock)
done

sleep 2
loggedinuser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')
echo "$loggedinuser has successfully logged on! The Dock appaears to be loaded with PID $dockStatus."