What a safe way to detect installed components of Microsoft Office?
-
13-12-2019 - |
Question
I am looking for the safest way to detect what components of Microsoft Office, if any, are installed on a given workstation. I realize this could be seen as a question for Serverfault as well, but since I'll be using this in a script and many people here are more familiar with the inner workings of Office, I thought this would be the best place to ask.
I've looked at the uninstall key, but it shows components that do not actually exist on the system. I believe this has to do with the way Office can install a component on first access. I'm not fond of looking for executables as the path can theoretically change.
Solution
I ended up testing for specific registry keys, taking into account the differences between 32 and 64-bit Windows installs. I'm paying attention to the following registry locations/values:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\12.0\
—The base Office12 key on a 64-bit Windows installHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\
—The base Office12 location on a 32-bit Windows installOffice base path
\Outlook\InstallRoot\Path
—Key signifying Outlook installation pathOffice base path
\Registration\{90120000-0012-0000-0000-0000000FF1CE}
—Key for Office 12 Standard GUIDOffice base path
\Registration\{90120000-0011-0000-0000-0000000FF1CE}
—Key for Office 12 Professional Plus GUID
With these locations I've been able to:
- Detect whether Office is installed.
- Detect the version of Office that is installed.
- Detect whether Outlook is installed.
I have not attempted to get any more granular than this.
OTHER TIPS
If you really think you cannot rely on paths to exe's or dll's, I would diff the registry (many tools for this exist) of before and after snapshots of installing the various components. In my experience however, I find it necessary to test existence of dll's and other files for detecting installed components for Office (I had to test for VBA dlls to detect presence of visual basic module installed, for example). The paths of files can only change so much. You just need to be cognizant of 32-bit and 64-bit patching, and winxp and win7 pathing.