Skip to main content
Question

Email notifications during imaging

  • May 11, 2018
  • 6 replies
  • 43 views

Forum|alt.badge.img+3

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?

6 replies

AVmcclint
Forum|alt.badge.img+21
  • Esteemed Contributor
  • May 11, 2018

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.


Forum|alt.badge.img+11
  • Valued Contributor
  • May 11, 2018

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

Can share if you're interested.


Brad_G
Forum|alt.badge.img+16
  • Valued Contributor
  • May 12, 2018

@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.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • May 14, 2018

@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.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • May 14, 2018

@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.


Forum|alt.badge.img+11
  • Valued Contributor
  • July 18, 2018

@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:

#!/bin/bash
#Logs which imaging workflow was run

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

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

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

#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/main.cf
if grep 'your smtp server here' /etc/postfix/main.cf
    then
        echo "SMTP server already configured"
    else
        echo "SMTP server not configured, adding now"
        echo "relayhost = your smtp server here" >> /etc/postfix/main.cf
    fi



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

EOF