Posted on 08-03-2012 08:43 AM
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.
Solved! Go to Solution.
Posted on 08-03-2012 09:32 AM
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.
Posted on 08-03-2012 09:34 AM
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.
Posted on 08-03-2012 09:32 AM
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.
Posted on 08-03-2012 09:34 AM
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.
Posted on 08-03-2012 11:38 AM
Thank you talkingmoose & dpertschi for your response - both helped achieve this task - appreciate your input!
Great weekend!
Posted on 05-09-2013 07:21 AM
Gurr why is this not listed at: https://jamfnation.jamfsoftware.com/extensionAttributes.html ?
Posted on 05-09-2013 09:53 AM
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!
Posted on 05-19-2013 08:39 AM
It's there now. :-)
Posted on 05-20-2013 06:10 AM
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.
Posted on 05-29-2013 05:24 PM
Hey Josh - Love the feedback. Thank you!
Jake
Posted on 04-16-2014 02:23 PM
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?
Posted on 04-16-2014 02:32 PM
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
Posted on 03-30-2017 01:52 PM
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
Posted on 03-30-2017 08:54 PM
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>