Skip to main content

Hello all,



I need help creating 2 Extension Attributes – 1 for Office 2011 & the other for Office 2008 – to display this info for inventory. I’ve been searching around for this, but so far no luck – I’d appreciate it if someone can help me with this. Thank you.

I think this would do it, modify similarly for 2011.
Not sure if there is a more stable place to find it, like a package receipt or not. With an explicit path like this you have to hope all machines are alike.



#!/bin/sh
??Office08Version=`/usr/bin/defaults read /Applications/Microsoft Office 2008/Microsoft Word.app/Contents/Info CFBundleVersion`?
echo "<result> $Office08Version </result>"??

exit 0


Or, since your collecting this via recon anyway, you could make smart groups to find certain versions or use Inventory to report the same.


Several years ago (Office 2004 days) Microsoft didn't update the version numbers of all applications. They would only rev the applications that were actually updated. We asked them to provide a means of knowing the current overall version and they responded with "use the version number from the Office Component Plugin". That file's version was updated every time.



Today, updates for Office 2008 and 2011 rev each application's version number whether it's actually updated or not. If you just choose an application such as Word and go by its version number then you don't need to use an extension attribute. That information is already collected by Casper.



If you'd prefer to go the old-school method of using the Office Component Plugin (that's what I do) then this should work for Office 2011:



#!/bin/sh

if [ -d /Applications/Microsoft Office 2011 ] ; then
RESULT=$( defaults read /Applications/Microsoft Office 2011/Office/MicrosoftComponentPlugin.framework/Versions/14/Resources/Info CFBundleShortVersionString )
echo "<result>$RESULT</result>"
else
echo "<result>Not Installed</result>"
fi


If the script finds the existence of the directory "Microsoft Office 2011" in the Applications folder then it will proceed to read the version number in the Component Plugin framework. Otherwise, it will report "Not Installed".



Office 2008 should be similar. You'll just need to adjust the path.


Thank you talkingmoose & dpertschi for your response - both helped achieve this task - appreciate your input!



Great weekend!


Gurr why is this not listed at: https://jamfnation.jamfsoftware.com/extensionAttributes.html ?


Hi quedayone -



If there is an extension attribute posted in the discussions, please encourage the community to upload them to the Extension Attributes repository for the proper Third Party Product.



For example, the Extension Attribute above for Microsoft Office can be uploaded here: https://jamfnation.jamfsoftware.com/uploadFile.html?productID=4&type=1.



It is great to see this repository continue to grow and be useful for the community. Also, if you have any feedback on how we can make this more useful, please let us know! Thanks!


It's there now. :-)


Jake:



- A link to "Extension Attributes" that's paginated, categorized, and searchable.
- The ability to "vote up" and comment on EA's for effectiveness and good form
- Import/Export that works reliably*



*This might be people trying to create XML manually, so I'm not quite sure if that's JAMF's problem or user error.


Hey Josh - Love the feedback. Thank you!



Jake


is there away to have a script run that would look for the version of office 2011 or 2008 with out having to have to different scripts?


Not tested at all, but I think this should work-



#!/bin/sh

if [ -d /Applications/Microsoft Office 2011 ] ; then
RESULT=$( defaults read /Applications/Microsoft Office 2011/Office/MicrosoftComponentPlugin.framework/Versions/14/Resources/Info CFBundleShortVersionString )
echo "<result>$RESULT</result>"
elif [ -d /Applications/Microsoft Office 2008 ] ; then
RESULT=$( defaults read /Applications/Microsoft Office 2008/Office/MicrosoftComponentPlugin.framework/Versions/12/Resources/Info CFBundleShortVersionString )
echo "<result>$RESULT</result>"
else
echo "<result>Not Installed</result>"
fi

Here is one that will look for version of Outlook in MS Office 2008, 2011 and 2016 for Mac:



#!/bin/sh
if [ -d /Applications/Microsoft Office 2011/Microsoft Outlook.app ] ; then
RESULT=$( sudo defaults read /Applications/Microsoft Office 2011/Microsoft Outlook.app/Contents/Info.plist CFBundleShortVersionString )
echo "<result>$RESULT</result>"
elif [ -d /Applications/Microsoft Office 2008/Microsoft Outlook.app ] ; then
RESULT=$( sudo defaults read /Applications/Microsoft Office 2008/Microsoft Outlook.app/Contents/Info.plist CFBundleShortVersionString )
echo "<result>$RESULT</result>"
elif [ -d /Applications/Microsoft Outlook.app ] ; then
RESULT=$( sudo defaults read /Applications/Microsoft Outlook.app/Contents/Info.plist CFBundleShortVersionString )
echo "<result>$RESULT</result>"
else
echo "<result>Not Installed</result>"
fi

You can also use Spotlight if it is enabled, which is pretty fast.



#!/bin/bash

# get Microsoft app versions

for app in /Applications/Microsoft* ; do
appname="$(mdls -name "kMDItemFSName" "${app}" | awk '{$1=$2=""; print $0}')"
appvers="$(mdls -name "kMDItemVersion" "${app}" | awk '{print $3}')"
echo "<result>${appname} ${appvers}</result>"
done


sample output:



<result>  "Microsoft Excel.app" "15.19.1"</result>
<result> "Microsoft PowerPoint.app" "15.19.1"</result>
<result> "Microsoft Word.app" "15.19.1"</result>

Reply