2012-04-24 30 views
1

我正在創建一個應用程序,它應該在不同的Windows操作系統版本上準確檢索所有軟件和修補程序更新,這涉及許多查詢過程。具體的一種方法是查詢Win32_QuickFixEngineering類。現在用下面的C#代碼,我可以這樣做:什麼是HotfixID ='文件1'的修補程序?

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' 

所以我的問題是,這些也是更新或修補程序?或者是什麼?如果他們是,爲什麼有HotfixID名爲'文件1'?爲什麼他們的'ServicePackInEffect'會在HotfixID上說明它應該是什麼?

+0

修補程序是在 – Will 2012-04-24 03:19:11

+1

這不是我所看到的。使用WMI代碼生成器實用程序來試驗查詢。請務必查看*全部*字段。 http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=8572在superuser.com上詢問更多關於它的問題 – 2012-04-24 03:25:44

+0

我也試過了。我得到460行,其中約360個是更新,具有正確的HotfixID和描述,其中約100個具有HotfixID ='File'和ServicePackInEffect ='KB *******'。我使用Windows XP btw。 – user919789 2012-04-24 04:00:35

回答

0

我有同樣的交易。我正在檢查是否通過configman安裝了修補程序。他們似乎首先運行修補程序,前面,然後跟進常規修補程序等。

0

如果您有明文File 1HotFixID那麼您可以從ServicePackInEffect列中檢索相關標識符。

HotFixID  ServicePackInEffect 
================================== 
KB941569.  . 
KB898461.  SP3. 
File 1.  KB982665. 
...   ... 
相關問題