Posted on 07-05-2017 12:07 PM
What i want to do is when a machine is done imaging via DEP it sends an email to an account with serial number, user and model. This I have working in a script. I now what to add a list of applications that are installed, when it completes.
I want to run this script first and then attach the file applist.txt
appVersionList=$(mdfind -onlyin /Applications 'kMDItemContentType==com.apple.application-bundle' -attr "kMDItemDisplayName" -attr "kMDItemVersion" | sed 's/^.*kMDItemDisplayName//' | sed 's/kMDItemVersion//g' | tr '=' ' ' | sort >> /tmp/applist.txt)
exit 0
Here is the script for sending the email.
sHost=$(networksetup -getcomputername)
theserial="$(ioreg -l | grep IOPlatformSerialNumber | sed -e 's/."(.)"/1/')"
user=$(ls -l /dev/console | awk '/ / { print $3 }')
model=$(ioreg -l | awk '/product-name/ { split($0, line, """); printf("%s
", line[4]); }')
mail -s "Apple DEP Image Completed: $sHost" "it@corp.com" <<EOF
DEP imaging done for machine $sHost
Serial: $theserial
User is: $user
Model is: $model
EOF
Anyone know the command lines to do this.
Posted on 07-06-2017 11:57 AM
Sure, remove the (below) so the list of apps remains in the appVersionList variable. Now copy this line to the email script and you'll be able to do Apps are: $appVersionList.
>> /tmp/applist.txt