我如何获得已安装的更新和修补程序的列表? [英] How do I get a list of installed updates and hotfixes?

查看:834
本文介绍了我如何获得已安装的更新和修补程序的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这已经安装在我的电脑上,从Microsoft Windows Update或知识库未来每一个更新和修补程序的列表。我需要在KBxxxxxx或一些类似的重新presentation的形式,每个ID ...

A list of every update and hotfix that has been installed on my computer, coming from either Microsoft Windows Update or from the knowledge base. I need the ID of each in the form of KBxxxxxx or some similar representation...

目前我有:

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());

但是,这似乎并没有列出一切,只列出了QFE的。

But this does not seem to list everything, it only lists QFE's.

我需要它工作在Windows XP,Vista和7。

I need it to work on Windows XP, Vista and 7.

推荐答案

您可以使用的 IUpdateSession3 :: QueryHistory方法
返回的条目的属性是在http://msdn.microsoft.com/en-us/library/aa386400(VS.85).aspx

You can use IUpdateSession3::QueryHistory Method.
The properties of the returned entries are described at http://msdn.microsoft.com/en-us/library/aa386400(VS.85).aspx

Set updateSearch = CreateObject("Microsoft.Update.Session").CreateUpdateSearcher
Set updateHistory = updateSearch.QueryHistory(1, updateSearch.GetTotalHistoryCount)

For Each updateEntry in updateHistory
  Wscript.Echo "Title: " & updateEntry.Title
  Wscript.Echo "application ID: " & updateEntry.ClientApplicationID
  Wscript.Echo " --"
Next

编辑:也看看<一href="http://msdn.microsoft.com/en-us/library/aa387287%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/aa387287%28VS.85%29.aspx

这篇关于我如何获得已安装的更新和修补程序的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆