Extension Attributes to report on DDM Scheduled macOS Updates

sdagley
Esteemed Contributor II

Since I don't see the info currently available in Jamf Pro as built-in Smart Group or Advanced Computer Search criteria I created the following EAs to report the macOS version and deadline date of any pending Declarative Device Management Scheduled Update command. I expect/hope Jamf will add them as eventually, but in the meantime... 

EA script that returns a String Data Type with the version number for any pending DDM scheduled macOS update:

#!/bin/sh

DDMSoftwareUpdateInfo="/private/var/db/softwareupdate/SoftwareUpdateDDMStatePersistence.plist"
result="No Update Pending"

if [ -e "$DDMSoftwareUpdateInfo" ]; then
	pendingUpdate=$(/usr/bin/defaults read "$DDMSoftwareUpdateInfo" | /usr/bin/grep TargetOSVersion | /usr/bin/cut -d \" -f 2)
	if [ -n "$pendingUpdate" ]; then
		result="$pendingUpdate"
	fi
fi

echo "<result>$result</result>"

 

EA script that returns a Date Data Type with the deadline of any pending DDM scheduled macOS update (since returning a non-date formatted result from an EA set for the Date Data Type is a Bad Idea™ this EA returns "2001-01-01 00:00:00" if there is no update scheduled): 

#!/bin/sh

DDMSoftwareUpdateInfo="/private/var/db/softwareupdate/SoftwareUpdateDDMStatePersistence.plist"
result="2001-01-01 00:00:00"

if [ -e "$DDMSoftwareUpdateInfo" ]; then
	updateDeadline=$(/usr/bin/defaults read "$DDMSoftwareUpdateInfo" | /usr/bin/grep TargetLocalDateTime | /usr/bin/cut -d \" -f 2 | /usr/bin/tr 'T' ' ')
	if [ -n "$updateDeadline" ]; then
		result="$updateDeadline"
	fi
fi

echo "<result>$result</result>"

 

2 REPLIES 2

Bol
Valued Contributor

Very nice and thanks for sharing your work, kudos to you. 
I love how we always come together to plug the holes Jamf has't filled yet.

sdagley
Esteemed Contributor II

@Bol wrote:

I love how we always come together to plug the holes Jamf has't filled yet.


My sentiments as well