Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Remotely display Office 2004 version info Apps
If you are someone who supports a large number of Macs with Microsoft Office, you might need to know how to remotely discover the installed version. Here is a nice quick method to do so. This is a ruby one-liner that prints the version of Entourage. I send this out with ARD.
ruby -e 'File.open("/Applications/Microsoft Office \
2004/Microsoft Entourage/rsrc") { |f| puts f.read.scan(/<key>\
CFBundleVersion<\/key>\s*<string>([^\r\t\n]*)<\/string>/) }'
It's trivial to write a similar perl one liner; I just don't write perl code unless I have to. python would be fairly simple as well, it's just harder to make it a cool one-liner.

I've only tested this with Office 11.2.x, so it might not work with older versions of Office 2004. I've altered the ruby on all my machines here, but this doesn't rely upon anything strange, so it should work with the default ruby in 10.3/10.4. It is also reliant upon the path, so if you've changed the Office folder name or location, or the name of the Entourage executable, you'll have to alter the path in the command.

Inside the Entourage Resource fork is a plst resource, which appears to be a normal plist file stuffed into a resource fork. I pull the normal CFBundleString from there. The resource fork of any file can be read with standard unix tools by reading /rsrc. The resource fork of somefile would thus be somefile/rsrc.

To figure out what I needed to read, I just ran DeRez from the Developer Tools to see what was in Entourage's resource fork.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[4,325 views]  

Remotely display Office 2004 version info | 5 comments | Create New Account
Click here to return to the 'Remotely display Office 2004 version info' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Two points
Authored by: hayne on Jul 17, '06 08:34:48AM

1) While using "foo/rsrc" will work to access the resource fork of a file "foo", that usage is now deprecated. The recommended way is to use "foo/..namedfork/rsrc"

2) A simpler way to extract the desired info would be to use the 'strings' command followed by 'grep'. For example, the following works on my version of Office X:

strings "/Applications/Microsoft Office X/Microsoft Entourage/rsrc" | grep -A 1 CFBundleVersion



[ Reply to This | # ]
Re: better output
Authored by: thebug on Jul 17, '06 02:57:41PM

1) I didn't know that, though a quick google finds similar comments all over, and it works in Panther. Thanks.

2) While this works, it's not what I wanted, so I didn't do it. :-)

There's a difference in looking at the ARD UNIX results window and seeing:

11.2.5

and seeing:

<string>11.2.5</string>

You can see all the output if you want, but it'll only show you the last line in status window.

And yes, a few more piped unix commands, and you get some the same nice output. But ruby was easier (for me). And can be added to my ruby sysadmin lib.



---
Outside of a dog, a book is man's best friend. Inside of a dog, it's too dark to read.



[ Reply to This | # ]
ARD3 does this for you?
Authored by: Sebbo on Jul 17, '06 11:42:03AM

If you're sending out the command via ARD, is this not easier to use the Software Version Report feature?

Reports > Software Version…

One can compare versions of up to 10 apps to against those installed on the admin machine. Tick "Rebuild data for report" to ensure you're using fresh (not cached) data. I've been using this with Office 10 and 11. Does take longer than expected to gather the data though.



[ Reply to This | # ]
ARD3 does this for you?
Authored by: thebug on Jul 17, '06 02:33:24PM
That's why I wrote this. Compared to that report, this is Fast. Not to mention that the report is not always correct.

It doesn't take much for the command to be altered, adding other logic. I'll often want to find machines with a version older than x.y.z. Or, I need to know about certain versions mixed with various OS versions. Makes it quicker to re-select those machine in ARD to send out the update command/package/etc.

I have a command that can log results to a database that I merge against the asset tracking database. That nicely tracks everything, and when a new machine is deployed, it shows up on my list w/o having to scan it from ARD as well as giving me some idea where it might be....I have many locations/ip blocks a machine could end up in.

So yeah, the report is nice, and works. I find my solution to be nicer. :-)

OTH, the report works w/o you having to knock out a unix command. This trick only works for apps with Resource forks, though you can do a similar thing for most .app apps, by looking at SomeApp.app/Contents/Info.plist instead of the App/rsrc file.

Though it's much simpler to just do:

defaults read '/Applications/App.app/Contents/Info' CFBundleVersion

---
Outside of a dog, a book is man's best friend. Inside of a dog, it's too dark to read.

[ Reply to This | # ]

BASH
Authored by: joelbruner on Nov 26, '07 04:16:25PM
Nice! The Ruby way is super quick... of course I found it after I cobbled together a bash version -- not as fast cause I used a bunch of pipes to other progs, but's that's UNIX eh? So here's a shell script for Unix edification:

#!/bin/bash
strings "$1/..namedfork/rsrc" | grep -a -A 1 CFBundleGetInfoString | grep string | sed 's/<string>//g' | awk {'print $1'}
Here's Apple Technote 2013 of plst resource forks
Also, while investigating resource forks, I found Rezilla an awesome freeware OS X app for getting into resource forks... I never did want to pay for ResEdit

[ Reply to This | # ]