Java Version Smart group

brandonalexande
New Contributor

I'm trying to get a smart computer group running to check for Java/java version. I can't seem to get it working. I use the script below in an Extension Attribute and have the group set for "is not" Java 8 Update 131 build 11

Any ideas?

#!/bin/sh
version=`defaults read /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Info CFBundleShortVersionString`

echo "$version"
1 ACCEPTED SOLUTION

Chuey
Contributor III

When viewing the computer record and looking at your Java Version Extension Attribute, is it reporting the "Java 8 Update 131 build 11"?

I just noticed you don't have:

echo "<result>$version</result>"

From my understanding <result> tags are necessary for it populate the EA.

View solution in original post

5 REPLIES 5

Chuey
Contributor III

When viewing the computer record and looking at your Java Version Extension Attribute, is it reporting the "Java 8 Update 131 build 11"?

I just noticed you don't have:

echo "<result>$version</result>"

From my understanding <result> tags are necessary for it populate the EA.

View solution in original post

brandonalexande
New Contributor

i removed the result tags for testing, I'll put them back in and then see what i get in the Inventory field, which i didn't know was there :). Thanks

lunddal
Contributor

And perhaps use CFBundleVersion instead of CFBundleShortVersionString which will give you 1.8.131.11 instead of Java 8 Update 131 build 11.

brandonalexande
New Contributor

There we go, your pointing me to the EA tab in inventory greatly sped up me resolving the issue. for future reference the script below did it (all along i had single quotes around the <result> tags, that was the issue). Smart Computer Groups criteria using the EA operator is not value Java 8 Update 131 build 11

#!/bin/sh
version=`defaults read /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Info CFBundleShortVersionString`
echo "<result>$version</result>"

Chuey
Contributor III

@brandonalexander Glad you got it working!