Checking for Windows update presence via command line

Just a quick note on how to check if some specific Windows update is installed on the system via command prompt. I thought I already took a note of this, but was not able to find existing post on this. While investigating an issue or doing troubleshooting something more often than not you may need to make sure if some specific update is present in the system or not. And not always you may want to wade through GUI to check this. Let’s say you may want to automate this process or do some mass discovery by running script on multiple machines.

Option 1. Query WMI (Windows Management Instrumentation) namespace.

1-A. Using wmic.exe (powerful, user-friendly CLI to the WMI namespace):

wmic qfe get hotfixid | find "KB99999"

wmic qfe | find "KB99999"

1-B. Using PowerShell:

Get-WmiObject -query 'select * from win32_quickfixengineering' | foreach {$_.hotfixid}

Option 2. Using PS commandlet get-hotfix which was introduced in PS 2.0:

get-hotfix -id KB974332

So this should be enough for most of the cases.

Leave a Reply

Your email address will not be published. Required fields are marked *