Preface: Maybe I'm missing something obvious...
For DEP deployments, we have an Enrollment Complete policy that waits until a user is logged in to throw up a splash page and custom triggers our big config policy to then do the configuring we want, then it reboots, etc. Here's the logic in the Enrollment Complete script that confirms the user is logged in before kicking off the config:
#!/bin/bash
until [[ $LoggedInUser != "_mbsetupuser" && $LoggedInUser != "loginwindow" ]]; do
LoggedInUser=$(defaults read /Library/Preferences/com.apple.loginwindow.plist lastUserName)
sleep 1
done
echo "$LoggedInUser has logged in, beginning configuration..."
The issue is that the login process begins immediately after the Create User screen, thereby updating LoggedInUser to pass the until loop. This would be fine, but following Create User is the Choose a Time Zone screen. So sometimes, if a user doesn't pick a Time Zone quickly enough, the splash screen comes up over the Choose a Time Zone screen. A number of our policies then fail because the user isn't really fully logged in.
I'm assuming I can solve this with another condition in the until loop. Any ideas what would be the most reliable check to ensure the Choose Your Time Zone page has completed? I thought about [[ $(systemsetup -gettimezone) != "America/Los Angeles" ]], as that's the default, but we, of course, have a Los Angeles office.
There's got to be something, though, I can latch onto here, right?
Appreciate any help in advance.
M