Featured Resource:

line

Newsletter

Email Address:


line

Ask the Expert

Have a question for our resident expert? Email your questions to Bob or post in the Forum.

« More Notes on Vista's Search Service | Main | Group Policy Inventory »

Script For Determining Installed Hotfixes

A script can get some quick details about installed hotfixes, by querying the WMI Win32_QuickFixEngineering class. The following properties are provided:

Caption - Short textual description, usually a URL describing the hotfix in question.
CSName - Name of the local computer, omitted from sample as it is not very helpful.
Description - As you'd expect this is to store a description of the fix, for MS hotfixes it normally reads "Update" or "Security Update". You are already digging for hotfixes, so this is also not too helpful here and is omitted from the sample scripts below.
FixComments - Additional comments that relate to the update; however it appears to be unused as I've never seen it with any data applied. Omitted from samples.
HotFixID - A unique ID can be entered here as the hotfix name or a GUID (globally unique identifier) for the update.
InstallDate - When the fix was installed. It does not need to have a value to indicate that the object is installed, in fact it is normally not populated at all.
InstalledBy - The SID (security ID) for the account used to installed the update, if not known it is empty. As you get a SID back you'll need more code to make a friendly name out of it.
InstalledOn - Date that the update was installed. However again in a unfriendly format (hexadecimal).
Name - Name of the hotfix. Just when you thought we had stumbled upon a property we can use-- this is usually unpopulated.
ServicePackInEffect - Service pack in effect when the update was applied. If no service pack has been applied, the property takes on the value SP0. If it cannot be determined what service pack was in effect, this property is empty (null). Guess what? I usually find it null.
Status - Various operational and nonoperational statuses can be defined here, but I find they or normally not. As documented, you "should" find operational statuses like "OK", "Degraded", and "Pred Fail". Nonoperational statuses like "Error", "Starting", "Stopping", and "Service". See any helpful values on your systems?

It is annoying that WMI holds the promise of so much helpful information when upon closer inspection we are very often disappointed to find values not used or very "unfriendly" by nature...

On my systems, HotFixID and Caption were all I found helpful. Feel free to check them all-- they are documented all around, but no one seems to point out the real value or use of these values. I'll do the same for other WMI classes in the future. To get back the "helpful" information using a script, go with the following:

For VBScript

Set wmiColl = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_QuickFixEngineering ")

For Each wmiObj In wmiColl

WScript.Echo "HotFixID: " & wmiObj.HotFixID
WScript.Echo "Caption: " & wmiObj.Caption

Next

For PowerShell

$wmiColl = Get-WmiObject Win32_QuickFixEngineering *

foreach-Object{

Write-Output ("HotFixID: " + $wmiColl.HotFixID)
Write-Output ("Caption: " + $wmiColl.Caption)

}

Comments

How to View Hotfix InstallDate in Vista OS

Try this one on for size:

Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcher
intHistoryCount = objSearcher.GetTotalHistoryCount

Set colHistory = objSearcher.QueryHistory(1, intHistoryCount)

For Each objEntry In colHistory
WScript.Echo "Title: " & objEntry.Title
WScript.Echo "Date: " & objEntry.Date
WScript.Echo
Next

Post a comment

(All comments are approved by site leader before appearing here. Thanks for commenting!)

Library Resources

line
line

Bob Kelly's Bio:

Bob Kelly is the founder of AppDeploy.com — a resource focused on desktop management products and practices. He is author of the Start to Finish Guide to Scripting with KiXtart and The Definitive Guide to Windows Desktop Administration. He is also president and co-founder of iTripoli, Inc. who provide AdminScriptEditor.com, home to an integrated suite of scripting tools and a shared library of scripts and language help. Not enough? For more on Bob click here.