Email notifications during imaging

New Contributor II

During our Windows OSD through SCCM we receive an email as the image starts and finishes. Would also like to get this working while imaging MacOS devices via JAMF Pro. Has anyone got this working or could provide some advice on how to achieve this?


Honored Contributor

I've setup a Smart Group that notifies me when a computer is added that has the latest version of the OS (in our case 10.12.6) I use this as a sign that imaging is completed. It doesn't necessarily mean that all the post-imaging tasks are completed (like joining AD and installing required apps), but when I get that email I know that the imaging itself is done and the computer has rebooted and collected an initial inventory.

Valued Contributor

We do something like that emails a noticeboard to say machine name, workflow used etc.

Can share if you're interested.

Contributor II

@allanp81 , I'd be interested to see what you're doing. We do the OSD email notification here and our on-site folks could benefit from something from the Mac side as well.

Thanks in advance.

New Contributor II

@allanp81 would love to see what you guys are doing. I've been racking my brain trying to work out a way in which we can achieve this.

New Contributor II

@AVmcclint I will give that a go and see how it works out for me, however I was looking for something that might confirm that the imaging process has completed successfully.

Valued Contributor

@fidg0010 We simply have a script named the same as the imaging workflow name, added to Jamf. We then run this at the end of the imaging process:

#Logs which imaging workflow was run

#make sure log directory exists
if [ ! -d "/Library/Application Support/KingstonUniversity" ]; then
  mkdir "/Library/Application Support/KingstonUniversity/"

#set log file location to log outcome of operation
logfile="/Library/Application Support/KingstonUniversity/kuworkflow.log"

#get the date and time
        while IFS= read -r line; do
            echo "$(date) $line"

#print workflow name based on script name
printf '%s
' "${0##*/}" | cut -f 1 -d '.' |addDate >> "$logfile"

workflow=$( printf '%s
' "${0##*/}" | cut -f 1 -d '.' )

echo $workflow

#Check that the smtp server is being specified in /etc/postfix/
if grep 'your smtp server here' /etc/postfix/
        echo "SMTP server already configured"
        echo "SMTP server not configured, adding now"
        echo "relayhost = your smtp server here" >> /etc/postfix/

echo "Emailing ServiceDesk"
sendmail -f -t <<EOF
Subject: Casper (Service Orchestration) Audit Information
Machine $HOSTNAME imaged with $workflow workflow