Posted on 04-07-2017 05:48 AM
Hello all, we are creating a script to report back if a system is compliant or non-compliant with out PIVM requirement. See below for the script I have so far. It works great in terminal, and returns either compliant or noncompliant as expected, but for some reason won't show anything as an EA script even after many recons. Am I not grasping something critical about what an EA does here? Thanks for any help, you guys rock!
See next post for script
Posted on 04-07-2017 05:50 AM
wow copy and paste fail...
Posted on 04-07-2017 05:51 AM
See attached screenshot
Posted on 04-07-2017 06:52 AM
You need to put a result in your echo. You need that in order for it to show up in your EA
#!/bin/sh
Check="Compliant"
echo "<result>$Check</result>"
Posted on 04-07-2017 07:03 AM
@SeanRussell To get scripts on JAMF Nation to appear in code format simply highlight your code and click on the >_ button. Alternatively you can simply add 3 backticks as as additional line in the top AND bottom of the script code like so:
```
My code
```
Posted on 04-10-2017 06:46 AM
Thanks, I guess I don't understand the Check/Result thing fully. I've tried adding a few things to the script but I'm coming up empty. Will keep giving a shot. Thanks again!
Posted on 04-10-2017 07:32 AM
@SeanRussell line 28 needs changed to echo "<result>NonCompliant</result>"
and line 31 needs changed to echo "<result>Compliant</result>"
for the EA to display properly. Hopefully that will help.
Posted on 04-10-2017 07:51 AM
One other small thing. For the purposes of an EA, at least one that isn't an "action" EA, I don't see the reason to put in an exit 1 in the case of a failed check, since you will never see that. The EA is simply uploading a result that you'll be able to track in your JSS whenever inventory is collected. I would leave out the exit lines altogether, or just make them both exit 0. Not that the exit 1 will cause any harm. It's just isn't doing anything for you in this case.
Posted on 04-10-2017 10:41 AM
Hi, In general you are correct - for reporting there is no need to throw an error.
However in this case there may be some point in "deliberately" throwing an error when "non-compliant"
- because it should show up in any logs as an error (that the thing is non-complient)
So in this case it's being used to convey extra information, beyond that, that the EA itself is showing..
i.e. the 'error' - that the thing was non-compliant - will also specifically appear in logs, showing as an 'error state'
That, I think, is what the author intended.
Posted on 04-11-2017 05:10 AM
Thanks for everything everyone! That worked great~!