Skip to main content
Question

Inventory - gathering Plug-In info [Extension Attribute question]

  • June 24, 2011
  • 4 replies
  • 10 views

donmontalvo
Forum|alt.badge.img+36

oops...wrong thread...

4 replies

donmontalvo
Forum|alt.badge.img+36
  • Author
  • Hall of Fame
  • June 24, 2011

I failed to mention...we have the Plug-Ins inventory option off because it caused the database to grow substantially and we want to prevent a repeat of the implosion we experienced last year.

So we're thinking of using an Extension Attribute instead.

Don


Forum|alt.badge.img+12
  • Contributor
  • June 24, 2011

I put in a feature request on the plug-ins. At the very least for them to provide the list of plug-ins by extension. For us .plugin and .component would be the most useful, although the quicktime components that we want to check on don't even feature. Extension Attributes!!!

Sorry to say though, I hadn't got round to writing a script for doing more than just the QuickTimes. If you are doing more, you might want to look at the formatting of the output!

#!/bin/bash

echo -n "<result>"

myPath="/Library/QuickTime/"
myFileType="*.component"
myPlist="/Contents/Info"
myArray=( "CFBundleGetInfoString" "CFBundleShortVersionString" )

for myFile in $myPath$myFileType
do ## Name of Quicktime component echo "$myFile" | cut -d "/" -f 4 myFile=echo $myFile | sed 's/ /\\ /g'

for myItem in "${myArray[@]}" do myValue=defaults read "$myFile"$myPlist $myItem 2> /dev/null echo " $myItem" ":" "$myValue" done
done

echo "</result>"

You could maybe look at adding the above inside another array, for each of the locations you wish to read files and then turn myFileType also into an array for each plugin type.

Best I can offer at the mo. Hope it is of some use.

Sean


Forum|alt.badge.img+12
  • Contributor
  • June 24, 2011

Don,

Sorry, realised I posted an older version of the script that doesn't handle spaces in names (should have logged into Casper and pulled the live version). Anyhow, this is our live version which does handle spaces in names.

It's a good example though, for anyone interested, of how a 'for' loop with spaces and globbing can screw you and why you should use a 'while read' instead when handling file names and spaces.

Sean

#!/bin/bash

echo -n "<result>"

myPath="/Library/QuickTime"
myPlist="/Contents/Info"
myArray=( "CFBundleGetInfoString" "CFBundleShortVersionString" )

echo "$myFile"
find "$myPath" -depth 1 -type d | sed 's/ /\\ /' | while read line
do echo $line | cut -d "/" -f 4 for myItem in "${myArray[@]}" do defaults read "$line"$myPlist $myItem 2> /dev/null done
done

echo "</result>"


donmontalvo
Forum|alt.badge.img+36
  • Author
  • Hall of Fame
  • August 13, 2013

...posted response to:

https://jamfnation.jamfsoftware.com/discussion.html?id=2813

Don