What's the best way in c# to determine is a given QFE/patch has been installed?
From stackoverflow
Doubt
-
The most reliable way is to determine which files are impacted by the QFE and use
System.Diagnostics.FileVersionInfo.GetVersionInfo(path)
on each file and compare the version numbers.edit: I think there's a way to check the uninstall information in the registry as well, but if the QFE ever becomes part of a Service Pack or rollup package that might report false negatives
From rpetrich -
Use WMI and inspect the Win32_QuickFixEngineering enumeration.
From TechNet:
strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colQuickFixes = objWMIService.ExecQuery _ ("Select * from Win32_QuickFixEngineering") For Each objQuickFix in colQuickFixes Wscript.Echo "Computer: " & objQuickFix.CSName Wscript.Echo "Description: " & objQuickFix.Description Wscript.Echo "Hot Fix ID: " & objQuickFix.HotFixID Wscript.Echo "Installation Date: " & objQuickFix.InstallDate Wscript.Echo "Installed By: " & objQuickFix.InstalledBy Next
The HotFixID is what you want to examine.
Here's the output on my system:
Hot Fix ID: KB941569 Description: Security Update for Windows XP (KB941569) Hot Fix ID: KB937143-IE7 Description: Security Update for Windows Internet Explorer 7 (KB937143) Hot Fix ID: KB938127-IE7 Description: Security Update for Windows Internet Explorer 7 (KB938127) Hot Fix ID: KB939653-IE7 Description: Security Update for Windows Internet Explorer 7 (KB939653) Hot Fix ID: KB942615-IE7 Description: Security Update for Windows Internet Explorer 7 (KB942615) Hot Fix ID: KB944533-IE7 Description: Security Update for Windows Internet Explorer 7 (KB944533) Hot Fix ID: KB947864-IE7 Description: Hotfix for Windows Internet Explorer 7 (KB947864) Hot Fix ID: KB950759-IE7 Description: Security Update for Windows Internet Explorer 7 (KB950759) Hot Fix ID: KB953838-IE7 Description: Security Update for Windows Internet Explorer 7 (KB953838) Hot Fix ID: MSCompPackV1 Description: Microsoft Compression Client Pack 1.0 for Windows XP Hot Fix ID: KB873339 Description: Windows XP Hotfix - KB873339 Hot Fix ID: KB885835 Description: Windows XP Hotfix - KB885835 Hot Fix ID: KB885836 Description: Windows XP Hotfix - KB885836 Hot Fix ID: KB886185 Description: Windows XP Hotfix - KB886185 Hot Fix ID: KB887472 Description: Windows XP Hotfix - KB887472 Hot Fix ID: KB888302 Description: Windows XP Hotfix - KB888302 Hot Fix ID: KB890046 Description: Security Update for Windows XP (KB890046)
From Bob King
0 comments:
Post a Comment