Menu Close

Setup Your Mac (1.5.1) via swiftDialog

Update: February 2023

Help mitigate zero-day attacks with the new “Outdated OS Action” in Setup Your Mac (1.7.0) which easily allows Mac Admins to specify a minimum OS version


A dot release for Setup Your Mac which offers an additional check to better execute with the Jamf Pro “Enrollment Complete” policy trigger

Introduction

Apple’s Automated Device Enrollment helps to streamline Mobile Device Management (MDM) enrollment and device Supervision during activation, enabling IT to manage enterprise devices with “zero touch.”

Setup Your Mac aims to simplify initial device configuration by leveraging swiftDialog and Jamf Pro Policy Custom Events to allow end-users to self-complete Mac setup post-enrollment via Jamf Pro’s Self Service.

(Please see the early Setup Your Mac via swiftDialog (1.5.0) post for step-by-step configuration instructions.)

Version 1.5.1

For Jamf Pro administrators using an Enrollment Complete trigger, version 1.5.1 adds an additional check to help ensure the built-in macOS Setup Assistant has completed before continuing execution.

Disclaimer: While Setup Your Mac (1.5.1) should work better with a Jamf Pro policy triggered by Enrollment Complete, the recommended approach remains for the script to be executed via a Jamf Pro Self Service policy.

Latest version available on GitHub.

07-Dec-2022

  • Updates to “Pre-flight Checks”
    • Moved section to start of script
    • Added additional check for Setup Assistant
####################################################################################################
#
# Pre-flight Checks
#
####################################################################################################

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Confirm script is running as root
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

if [[ $(id -u) -ne 0 ]]; then
    echo "This script must be run as root; exiting."
    exit 1
fi



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Ensure computer does not go to sleep while running this script (thanks, @grahampugh!)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

echo "Caffeinating this script (PID: $$)"
caffeinate -dimsu -w $$ &



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Validate Setup Assistant has completed
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

while pgrep -q -x "Setup Assistant" ; do
    echo "Setup Assistant is running; pausing for 10 seconds"
    sleep 10
done

echo "Setup Assistant is no longer running; proceeding …"



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Confirm Dock is running / user is at Desktop
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

while ! pgrep -q -x "Dock" ; do
    echo "Dock is NOT running; pausing for 10 seconds"
    sleep 10
done

echo "Dock is running; proceeding …"



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Validate logged-in user
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' )

if [[ -z "${loggedInUser}" || "${loggedInUser}" == "loginwindow" ]]; then
    echo "No user logged-in; exiting."
    exit 1
else
    loggedInUserID=$(id -u "${loggedInUser}")
fi
Posted in Jamf Pro, macOS, Scripts, swiftDialog

Related Posts