Storing Microsoft Office Major Versions in Environment Variables or AppSense Environment Manager Session Variables

There are times when you need to know the version of a particular Office application that is installed. I have worked in environments where the Office Suite is upgraded but Outlook remains on an older version due to other constraints. The rights and wrongs of that can be debated at another time. However, you still need to be able to cope with this scenario and configure an environment appropriately.

To this end, the following script was created. It uses the registry to determine the major version of the supplied Office application and sets either an Environment Variable or Environment Manager Session Variable named in the format $(OfficeApp)Version, e.g. WordVersion, OutlookVersion.

This will now give you the ability to script against the version installed. This can easily be achieved in Environment Manager where you could set this variable at, say PreDesktop (could also be set as a system environment variable at startup) and then use it to determine if the given application is installed. Once you’ve done that, you can establish the path to the application and dynamically create icons that always relate to the version of the application installed – no more dead icons or having to modify the config when a new Office version is deployed.

In addition you can use it to ensure that only the correct GPO templates are used for the version of the application/suite installed.

The only Office application that I have found that bucks this trend is Visio. Unfortunately, this application doesn’t seem to follow the same patterns in the registry as all the other ones in the suite – well not in all scenarios anyway. For that reason you may need to adjust the script to treat that differently. The Visio.UriLink.* key seems to hold the correct version number for this application.