Extension Attribute Returning Blank on 20% of Mac's

HNTIT
Contributor II

This script works fine as an EA on 80% of our Mac's but returns Blank on the rest.

The APP is there

And it we run this manually on the Mac it returns a result, but as an EA we get a blank.

If it didnt work on all our Mac's I'd understand I'd made a mistake, but its only a handful, any ideas ?

 

#!/bin/bash

ZScalerVersion=$(defaults read /Applications/Zscaler/Zscaler.app/Contents/Info.plist CFBundleShortVersionString)

/bin/echo "<result>$ZScalerVersion</result>"

 

Thanks

3 REPLIES 3

AJPinto
Esteemed Contributor

What happens if you run jamf recon verbose on an impacted device?

sdagley
Esteemed Contributor II

@HNTIT I recommend writing an EA so that it always returns something (if you're writing an EA that returns a date you _really_ need to return a valid date), even if the call to collect the data somehow fails to generate a result:

 

#!/bin/bash

result="Unknown"
ZScalerVersion=$(defaults read /Applications/Zscaler/Zscaler.app/Contents/Info.plist CFBundleShortVersionString)
if [ -n "$ZScalerVersion" ]; then
	result="$ZScalerVersion"
fi
/bin/echo "<result>$result</result>"

 

If you try that does the EA result from one of the impacted Macs return "Unknown" or is it still blank?

Shyamsundar
Contributor III

There are chances that the device that gives a Blank doesn't have a Zsacler installed, Please check those devices whether they Zsacler installed.