Deepak N
Deepak N

Reputation: 2571

C# code to find all office updates installed

In add or remove programs you can view list of updates/patches for MS office Outlook. Is there a way to get this information using c# code. We tried WMI code

const string query = "SELECT HotFixID FROM Win32_QuickFixEngineering";
var search = new ManagementObjectSearcher(query);
var collection = search.Get();

foreach (ManagementObject quickFix in collection)
    Console.WriteLine(quickFix["HotFixID"].ToString()); 

This only lists windows updates. Is there a way to list updates for office components?(for windows XP)

Upvotes: 3

Views: 2800

Answers (1)

Lars Tackmann
Lars Tackmann

Reputation: 20865

I believe you will have to use the registry to get these. The following registry keys should help:

@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"

You will have to loop though both the values for the HKLM and HKCU hives in order to be sure you have everything. Then you can filter on DisplayName and Publisher for each entry in order to get only the MS office patches.

Note you could also try to query the Win32_Product class to get products installed by the Windows installer. Although I have often found that it does not list everything you need (however it might be sufficient for your current problem - but I am not in a position to check right now).

Upvotes: 1

Related Questions