Font Collection/Counter Extension Attributes

jrosedietcher
New Contributor III

Hey All,

I'm looking to see if there's a best practice for reporting font collection via Jamf. We currently have font collection turned on in our inventory collection settings, however I'm trying to make a smart group to list only computers with "above X number of fonts."

Unfortunately, an EA for this does not already exist. I'm wondering if any of you have found better ways to do this or if an EA has been created for something like this?

4 REPLIES 4

mm2270
Legendary Contributor III

Are you only concerned with user installed typefaces, or do you also want to track the fonts installed in /Library/ and even /System/? Unless users are admins, they won't be able to install anything in those 2 locations, just inside their own ~/Library/Fonts/ path.

If all you're after is a straight up count of fonts installed in any user path, the following might help. You can convert this into an EA to send back the value, maybe saved as an integer format so you can easily build greater than/less than style groups or queries.

/usr/bin/mdfind -onlyin /Users 'kMDItemKind == "TrueType*" || kMDItemKind == "OpenType*"' | awk 'END{print NR}'

This will find any TrueType and OpenType fonts in those paths and present a total.

One thing to keep in mind - this will also find TrueType or OpenType fonts that aren't actually installed, such as ones that a user may have downloaded but not actually installed. The only way to properly search for ones installed would be to include the full path to say /Users/<username>/Library/Fonts/ for example.

jrosedietcher
New Contributor III

Thank you, this is very helpful. I'll give this a shot and see what I can accomplish.

jrosedietcher
New Contributor III

Sorry, yes - I am only looking for fonts contained in ~/Library/Fonts/

mm2270
Legendary Contributor III

In case it's helpful, you can use the following syntax. I actually wasn't aware mdfind would accept an asterisk in a path like the below, but it seems to work. I only have a small number of fonts installed at ~/Library/Fonts/ 4 to be exact, and it correctly returns 4 as the value when I run it.

/usr/bin/mdfind -onlyin /Users/*/Library/Fonts 'kMDItemKind == "TrueType*" || kMDItemKind == "OpenType*"' | awk 'END{print NR}'

Presumably if you have multiple active user profiles in /Users/ it would search inside all of them and report a total, but you'll need to test that out to see.