Extension Attribute Formatting

kbelluomo
Release Candidate Programs Tester

Hi JAMF Nation,

I have a quick question about formatting the output of Extension Attributes when conducting a computer inventory search with them.

I am currently using an EA that gives me a list of every single local user account on the computer, but when using this in a computer inventory search it displays them side-by-side as a row. Is there any way to return the results and display them more neatly in a column type format?

The bash script I'm using returns the local user accounts in an array, but this array could be any length depending on the amount of local user accounts on the computer. I tried making a for loop that iterates itself through the entire array and uses printf commands to indent and display the output nicely, but when I placed the for loop inside the <result></result> tags, it broke the EA output. And again, I can't simply make a simple echo statement (at least, I don't think I can) at the end of the script that prints the array nicely using indents, because the length of the array varies.

Any thoughts?

2 REPLIES 2

strider_knh
Contributor II

I don't know about Jamf Pro 10 but in 9.101 there is nor formatting for EAs. There used to be but they removed it all a while back.

mm2270
Legendary Contributor III

Doing printf against an array is the right approach. Are you doing it something like this?

echo "<result>$(printf '%s
' "${myarray[@]}")</result>"

That's the general format I use for these types of EAs and they show up properly. But... is this with version 10 of Jamf Pro, or version 9? We're still on 9.x currently, so there could be a formatting issue present in 10 I'm not aware of.