【发布时间】:2012-04-24 03:16:20
【问题描述】:
我正在创建一个应用程序,它应该在涉及许多查询过程的不同 Windows 操作系统版本上准确检索所有软件和修补程序更新。具体的一种方法是查询 Win32_QuickFixEngineering 类。现在使用以下 C# 代码,我可以这样做:
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_QuickFixEngineering");
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_QuickFixEngineering instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("HotFixID: {0}", queryObj["HotFixID"]);
}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
}
我得到了一系列与以下结果相同的结果:
HotfixID='File 1'
HotfixID='File 1'
HotfixID='File 1'
HotfixID='File 1'
HotfixID='File 1'
HotfixID='File 1'
HotfixID='File 1'
但当我查询属性“ServicePackInEffect”时,每个带有 HotfixID='File 1' 的查询都会显示如下内容:
ServicePackInEffect='KB2259213'
ServicePackInEffect='KB2431232'
ServicePackInEffect='KB2254332-IE7'
ServicePackInEffect='KB960680-v2'
ServicePackInEffect='KB2254343'
ServicePackInEffect='KB93089483'
所以我的问题是,这些也是更新还是修补程序?要不然是啥?如果是,为什么会有名为“文件 1”的 HotfixID?为什么他们的“ServicePackInEffect”会在 HotfixID 上说明它应该显示的内容?
【问题讨论】:
-
这不是我看到的。使用 WMI 代码生成器实用程序来试验查询。请务必查看所有字段。 microsoft.com/download/en/… 在 superuser.com 上询问更多问题
-
我也试过了。同样的结果。我得到了 460 行,其中大约 360 行是更新,具有正确的 HotfixID 和描述,其中大约 100 行具有 HotfixID='File' 和 ServicePackInEffect='KB*******' 。顺便说一句,我使用的是 Windows XP。
-
是的,上面的那个人说我应该把它发布在超级用户上。我应该删除超级用户上的那个吗?
-
我认为他的意思是在 SU 上询问热修复程序的结构是主题,但代码问题是关于 SO 的主题?
标签: c# wmi-query windows-update hotfix