Skip to main content
Solved

Extension Attribute Script Returns Wrong Result to Casper


Forum|alt.badge.img+2

Sorry if this is a duplicate question, but I did try searching first.

I am trying to add an extension attribute to determine if a set of Xerox Printer drivers are installed so I can use it as a scope for a policy.

I wrote a script based off of the one in the knowledge base article (See attached image).

When I run this script via ssh on a machine it returns the correct result (In this case "Yes" because there are printer drivers installed).

The same script run on the same computer as part of Casper's inventory update returns a result of "No".

Not sure what is going on that would cause this.

Best answer by mm2270

I have a feeling the wildcard use in the test is messing things up. It doesn't work for me either if I use it and replace the last part of the path test with something that exists on my Mac. I don't think you can use it that way, but maybe someone knows of a way to make it work as is.

I would recommend doing it this way for now-

#!/bin/bash

if [[ $(ls "/Library/Printers/PPDs/Contents/Resources/" | grep "8900X") ]]; then
    echo "Yes"
else
    echo "No"
fi
View original
Did this topic help you find an answer to your question?

4 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • Answer
  • April 28, 2015

I have a feeling the wildcard use in the test is messing things up. It doesn't work for me either if I use it and replace the last part of the path test with something that exists on my Mac. I don't think you can use it that way, but maybe someone knows of a way to make it work as is.

I would recommend doing it this way for now-

#!/bin/bash

if [[ $(ls "/Library/Printers/PPDs/Contents/Resources/" | grep "8900X") ]]; then
    echo "Yes"
else
    echo "No"
fi

Forum|alt.badge.img+14
  • Valued Contributor
  • 85 replies
  • April 28, 2015

#!/bin/bash

# Check /Library/Printers/Xerox/PDEs/XeroxFeatures.plugin for the CFBundleShortVersionString installed_driver=$(defaults read "/Library/Printers/Xerox/PDEs/XeroxFeatures.plugin/Contents/Info" CFBundleShortVersionString) echo "<result>$installed_driver</result>"


Forum|alt.badge.img+11
  • Contributor
  • 286 replies
  • April 28, 2015

@mikeharris I agree with @mm2270, I don't believe you can use a wildcard when putting something in quotes.


Forum|alt.badge.img+2
  • Author
  • New Contributor
  • 1 reply
  • April 28, 2015

MM2270's response was the fix.

Thanks a ton!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings