Report When Application Last Opened

March 18, 2019 - 1 minute read -

While Jamf Pro is capable of collecting Application Usage data, sometimes we just want to know when an application was last opened. This information is especially helpful when reclaiming unused licenses or retiring unused software.

Create an Extension Attribute in Jamf Pro using the Date data type. Then select Script for the input and paste in the following snippet. Though Self Service is used here, any application path can be substituted.



if [ ! -e "$APPLICATION_PATH" ]; then
    result="Not Present"

if [ -e "$APPLICATION_PATH" ]; then
    result=`/usr/bin/mdls "$APPLICATION_PATH" | /usr/bin/grep -w "kMDItemLastUsedDate" | /usr/bin/awk '{ print $3 }'`

if [ "$result" == "" ]; then
    result="2001-01-01 01:01:01"

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

Now that we are collecting this information it can be used when creating Smart Computer Groups or Advanced Computer Searches.

There is also a Feature Request for this on the Jamf Nation website.