I'm running this script in my ShellCommandTextReturn CIR.  Simply want to check to see if our Mac users have this line in their Chrome plist file.  If they don't, I'll base a script off of this to add it via smart label.

I can run this on my machine as root and myself with success but once made into a Custom Inventory Rule, regardless of the user having Chrome or not, the value will always be "No Chrome File Present"

This command does contain sub-commands so is KACE unable to run sub-commands in these CIRs? I'm running other simpler ones such as these with no problems:

ShellCommandTextReturn(diskutil info /dev/disk0 | egrep -i '(media name|total size|solid state)')
ShellCommandTextReturn(fdesetup status)

Here is my script:

if [ -f "/Users/$(who | grep console | awk '{print $1}')/Library/Preferences/com.google.Chrome.plist" ]; then if defaults read /Users/$(who | grep console | awk '{print $1}')/Library/Preferences/com.google.Chrome | grep AuthServerWhitelist 1>/dev/null; then echo ChromeKerberosSet=Yes; else echo ChromeKerberosSet=NO; fi ; else echo "No Chrome File Present"; fi
Answer Summary:
0 Comments   [ + ] Show Comments


Please log in to comment


I figured it out.

Apparently the K1000 didn't think I was smart enough to write my own BASH script so it added some extra quotes in certain places.  I checked the KAgent.log after an inventory of my machine and saw the original script then the KACE-ized version right after (the one that was actually getting executed) and removed some of my quotes to accommodate them getting added later.

So in short, if you're attempting to do some more advanced BASH scripting for Linux/Unix systems in your Custom Inventory Rules, use fewer quotes
Answered 11/12/2014 by: tylerpenn
Senior White Belt

  • yep. another way to look at it is to use backticks. Also, watch out for smart quotes. they will mess things up.
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja