Extension Attributes: iTunes, iPhoto, iMovie

josaxo
New Contributor

Would anyone happen to have extension attribute templates for iTunes, iPhoto, and iMovie? Any help is appreciated.

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

So if I'm understanding you correctly, you want a way to show the versions of these apps in a regular inventory report, not just in the details of a specific system. Is that right?

If so, then yes, you could write an EA for this. Should be pretty simple actually. And I'd agree. There is no way to do what you want other than an Extension Attribute. Regular inventory reports don't allow you to display a column for the version of a specific application.

The below is untested as I just threw this together in a few minutes, but give it a try. It should report all the apps version in one EA. You could of course write a separate one for each app if you want, which may give you better reporting capabilities.

#!/bin/sh

iTunesVers=`defaults read /Applications/iTunes.app/Contents/Info CFBundleShortVersionString`
iPhotoVers=`defaults read /Applications/iPhoto.app/Contents/Info CFBundleShortVersionString`
iMovieVers=`defaults read /Applications/iMovie.app/Contents/Info CFBundleShortVersionString`

echo "<result>iTunes = $iTunesVers
iPhoto = $iPhotoVers
iMovie = $iMovieVers</result>"

View solution in original post

5 REPLIES 5

mm2270
Legendary Contributor III

What exactly were you looking to capture? The application info should already be getting captured in the regular Application inventory. What more information on these apps were you looking to get through an Extension Attribute?

josaxo
New Contributor

I was hoping to display the version of iTunes, iPhoto, and iMovie in the main inventory report. Not quite sure how to approach this without an extension attribute. Any ideas?

mm2270
Legendary Contributor III

So if I'm understanding you correctly, you want a way to show the versions of these apps in a regular inventory report, not just in the details of a specific system. Is that right?

If so, then yes, you could write an EA for this. Should be pretty simple actually. And I'd agree. There is no way to do what you want other than an Extension Attribute. Regular inventory reports don't allow you to display a column for the version of a specific application.

The below is untested as I just threw this together in a few minutes, but give it a try. It should report all the apps version in one EA. You could of course write a separate one for each app if you want, which may give you better reporting capabilities.

#!/bin/sh

iTunesVers=`defaults read /Applications/iTunes.app/Contents/Info CFBundleShortVersionString`
iPhotoVers=`defaults read /Applications/iPhoto.app/Contents/Info CFBundleShortVersionString`
iMovieVers=`defaults read /Applications/iMovie.app/Contents/Info CFBundleShortVersionString`

echo "<result>iTunes = $iTunesVers
iPhoto = $iPhotoVers
iMovie = $iMovieVers</result>"

josaxo
New Contributor

This is great, thanks for the info. I broke these out into separate scripts for each app, and they seem to be working well (at least manually). Do you think there is any risk in these scripts generating any user prompts if no version is detected? I know there was an issue with a java version extension attribute displaying an installation pop-up if no version was detected, but my testing suggests that imovie and iPhoto do not act this way... Thanks again!

mm2270
Legendary Contributor III

Nah, if they don't exist no-one will get prompted for anything. However, you may end up getting odd results in your EA on those systems

If you've decided to break these out into separate Extension Attributes, consider doing something like this for each.

#!/bin/sh

if [ -e /Applications/iTunes.app ]; then
echo "<result>$(defaults read /Applications/iTunes.app/Contents/Info CFBundleShortVersionString)</result>"
    else
echo "<result>iTunes not installed</result>"
fi

Just modify accordingly for each app.

You can test if this is working by running something like this, which should echo back the other result line-

#!/bin/sh

if [ -e /Applications/iFoo.app ]; then
echo "<result>$(defaults read /Applications/iFoo.app/Contents/Info CFBundleShortVersionString)</result>"
    else
echo "<result>iFoo not installed</result>"
fi