Posted on 07-17-2020 10:22 AM
Hi Everyone,
I am looking to create a custom attribute to display "Citrix Files" version and was able to get the version by typing the following command:
"mdls -name kMDItemVersion /Applications/'Citrix Files.app'"
Any good documentation on how to display this to a custom attribute?
My end goal is to create a smart group to show which computers has older versions of "citrix files"
Solved! Go to Solution.
Posted on 07-17-2020 01:46 PM
You can create Smart Groups from application versions natively in the Jamf Pro UI. Use criteria Application Title and Application Version. The latter criteria lets you use a regex pattern instead of anything absolute, which should give you the ability to look for versions below a certain number. For example, say you wanted to capture any Macs with a Citrix Files version below 20.x, something like this may work. It kind of depends on the versioning scheme for Citrix Files, which I don't use myself, so I don't know how it's versioned.
1[0-9].[0-9]
That would capture anything starting with a 1 and followed by any number between 0 and 9, and then any other number following the period. The regex might have to be modified a little depending on things.
I would at least give that a try first.
Posted on 07-17-2020 10:49 AM
I created this:
#!/bin/sh
ver=`mdls -name kMDItemVersion /Applications/'Citrix Files.app' | awk '{print $3}'`
if [ $ver == "0" ]; then
echo "<result>No Citrix Files</result>"
else
echo "<result>$ver</result>"
fi
Posted on 07-17-2020 11:08 AM
It works however it displays as "20.7" and not 20.7 so maybe I could find a way to remove the quotes.
Posted on 07-17-2020 11:38 AM
Hi there. First question from me is, why would this need to be added as an Extension Attribute? If the app is located in the standard /Applications/ path, then the jamf binary should be picking up the version information and reporting that along with all the other apps there.
If it needs to be reported as an EA for some other purpose outside of the normal application reporting, then that's fine. I just want to be sure you knew that the version should be getting captured automatically.
If there's a valid reason for it to be an EA that I'm just not aware of, the EA you have is basically how you would do it. If you want to remove the quotes, simply throw in the -raw
flag in your mdls query, like so
mdls -raw -name kMDItemVersion "/Applications/Citrix Files.app"
This allows you to remove the awk
bit.
You could also change to double quotes around the entire program path as I have it, though it's fine either way.
Posted on 07-17-2020 12:04 PM
i removed the quotes by doing this
#!/bin/sh
mdls -name kMDItemVersion /Applications/'Citrix Files.app' | awk '{print $3}' | tr -d "
Posted on 07-17-2020 12:07 PM
@mm2270 The end goal is I wanted to find out who has a older version of "citrix files" by creating a smart group. Do you have another alternative that might be quicker
Posted on 07-17-2020 01:46 PM
You can create Smart Groups from application versions natively in the Jamf Pro UI. Use criteria Application Title and Application Version. The latter criteria lets you use a regex pattern instead of anything absolute, which should give you the ability to look for versions below a certain number. For example, say you wanted to capture any Macs with a Citrix Files version below 20.x, something like this may work. It kind of depends on the versioning scheme for Citrix Files, which I don't use myself, so I don't know how it's versioned.
1[0-9].[0-9]
That would capture anything starting with a 1 and followed by any number between 0 and 9, and then any other number following the period. The regex might have to be modified a little depending on things.
I would at least give that a try first.
Posted on 07-20-2020 07:15 AM
Thank you! I knew I was making it more complicated.