Win32_QuickFixEngineering
won't return all updates. Actually, it returns only updates restricted to QFE:
Updates supplied by Microsoft Windows Installer (MSI) or the Windows
update site (http://update.microsoft.com) are not returned by
Win32_QuickFixEngineering.
The update you're after is an MSI patch. Use Microsoft.Deployment.WindowsInstaller
(aka DTF - Deployment Tools Foundation, part of the WiX toolset) to query the applied MSI patches:
public static bool IsPatchAlreadyInstalled(string productCode, string patchCode)
{
var patches =
PatchInstallation.GetPatches(null, productCode, null, UserContexts.Machine, PatchStates.Applied);
return patches.Any(patch => patch.DisplayName == patchCode);
}
In this case, KB2468871 is one of .NET Framework 4 updates. The following will return true if the updates have been applied on the machine:
IsPatchAlreadyInstalled("{F5B09CFD-F0B2-36AF-8DF4-1DF6B63FC7B4}", "KB2468871");// .NET Framework 4 Client Profile 64-bit
IsPatchAlreadyInstalled("{8E34682C-8118-31F1-BC4C-98CD9675E1C2}", "KB2468871");// .NET Framework 4 Extended 64-bit
IsPatchAlreadyInstalled("{3C3901C5-3455-3E0A-A214-0B093A5070A6}", "KB2468871");// .NET Framework 4 Client Profile 32-bit
IsPatchAlreadyInstalled("{0A0CADCF-78DA-33C4-A350-CD51849B9702}", "KB2468871");// .NET Framework 4 Extended 32-bit
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…