Posted on 04-28-2015 08:17 AM
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.
Solved! Go to Solution.
Posted on 04-28-2015 08:52 AM
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
Posted on 04-28-2015 08:52 AM
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
Posted on 04-28-2015 10:05 AM
#!/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>"
Posted on 04-28-2015 12:01 PM
@mikeharris I agree with @mm2270, I don't believe you can use a wildcard when putting something in quotes.
Posted on 04-28-2015 12:56 PM
MM2270's response was the fix.
Thanks a ton!