Search code examples
c#windowswmiwindows-updatehotfix

API/WMI Query for complete list of hotfixes and updates installed on a system?


Previously, how to query for a list of hotfixes installed on a Windows system has been discussed, and the use of WMI and the class Win32_QuickFixEngineering was suggested as providing the information. However MSDN indicates that from Vista onwards this particular class only returns hotfixes, and not updates installed by other means.

An older question discusses the use of this class to get installed updates indicating the author is also not satisfied using it because of the limitation I described above. Unfortunately, as a comment on the accepted answer points out, the alternative solution of using the Windows Update Agent API will still indicate a hotfix has been installed even after it has been subsequently removed (it's querying the installation history, not the currently installed updates).

Does anybody know how to get in C# (via WMI or some other API) a complete list of updates and hotfixes installed on the system, which doesn't exclude some means by which updates may be installed, and won't return updates that were subsequently removed? Essentially, I'm after the same set of data as is available in 'Programs and Features' under the 'View Installed Updates' pane.

Apologies if this discussion ought to have been had on either of the linked questions previously looking at this issue, however with my current reputation the only way I could contribute to either question would be to submit a new answer, and that's definitely not the right way to ask a further question such as this.

Thanks!


Solution

  • In the absence of a reliable and complete programmatic way to achieve this I ended up using the wmic qfe command.