Posted on 08-11-2021 01:55 PM
The built-in Apple software update payload that we can use in a policy will save a plist file to /Library/Application Support/JAMF called .userdelay.plist. The presence of this plist means that the user has selected one of the deferral options. It was easy to create an extension attribute that checks the file path above for the plist file, but what I would also like to do is track how long of a deferral the user selected. The text of the plist file is below. What I would like to do is make an extension attribute that will report the value for the key called "lastChosenDeferDate".
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>140</key>
<dict>
<key>deferStartDate</key>
<date>2021-08-11T14:08:46Z</date>
<key>lastChosenDeferDate</key>
<date>2021-08-13T14:08:46Z</date>
</dict>
</dict>
</plist>
I thought this would basically be the same as the command we would use to find the version of an app installed, which is to get the value of the CFBundleShortVersionString key in info.plist. That command won't work on the userdelay.plist file. Does anyone know how I can get what I need for my extension attribute?
Solved! Go to Solution.
Posted on 08-11-2021 04:09 PM
lastChosenDeferDate is a nested Plist value
Better to use plistbuddy
/usr/libexec/PlistBuddy -c 'print ":140:lastChosenDeferDate"' <path to the plist file >
Posted on 08-11-2021 04:09 PM
lastChosenDeferDate is a nested Plist value
Better to use plistbuddy
/usr/libexec/PlistBuddy -c 'print ":140:lastChosenDeferDate"' <path to the plist file >
Posted on 08-12-2021 06:40 AM
This worked great. Thank you! I was doing it wrong and I didn't think about the fact that the key I wanted to focus on is nested. The plist file gets created whether or not the user defers the policy, so if they don't defer it, the key won't be present. So when my EA echos the results of what I call deferredTime, the result is totally blank. So, my question now is how do we create a result for an extension attribute to display if the key does not exist? When I first started this I had the assumption that the plist doesn't get created unless the user defers updates. Maybe my I need an elif command to check if the key is present in the plist.
Posted on 08-11-2021 04:42 PM
I will try that. Thanks 😊
I was trying to use PlistBuddy but I wasn’t doing it right.
08-12-2021 02:14 AM - edited 08-12-2021 10:40 PM
I'm interested in extracting the <string>GLX_DUD</string> to build a smart group from that string to create an extension attribute.
08-12-2021 04:08 AM - edited 08-12-2021 09:02 PM