70

I'm looking to find out if a KB is installed via command line.

6 Answers 6

69

In addition to systeminfo there is also wmic qfe

Example:

wmic qfe get hotfixid | find "KB99999"
wmic qfe | find "KB99999"

There is also update.exe

Or from powershell, just adjust it for your needs:

Get-WmiObject -query 'select * from win32_quickfixengineering' | foreach {$_.hotfixid}
4
  • 4
    How I've done it in the past. Really easy with psexec, but keep in mind the find command might not work unless you specify stdout instead of the weird hybrid crap wmic spits out on a regular basis. wmic /output:stdout qfe get hotfixid | find "KB99999".
    – songei2f
    Apr 27, 2011 at 11:59
  • Do I need to run it as administrator? Seems like other places tells me that I do need. So I want to check.
    – José
    May 11, 2016 at 0:31
  • For whatever reason, using "find" is giving me an incorrect format error. Tried single and double quotes. Sep 22, 2016 at 14:28
  • @Scott (and others who run into the same problem): The PS find cmdlet requires a parameter. The find.exe you run from cmd does not. Jan 10, 2018 at 15:11
19

PowerShell 2.0 contains the get-hotfix cmdlet, which is an easy way to check if a given hotfix is installed on the local computer or a remote computer. An example of the basic syntax is

get-hotfix -id KB974332
2
7

run "systeminfo" in a CMD window and it will pull back a load of statistics about your system including what patches are installed.

3

Some other possibilities: Grep %windir%\Windowsupdate.log for the KB number. Or use reg.exe to export the corresponding install keys.

3
  • 1
    My Windows didn't come with grep. I have to use find.
    – jscott
    Apr 27, 2011 at 13:50
  • @jscott: I know that grep is non-standard on Windows :-) Find or findstr would be more suitable. But I used the word grep here as in "to grep" to indicate the process in stead of literally meaning the utility "grep". Using grep as a verb is very common in the Unix circles I normally operate in, so I used the term more or less without thinking it might look odd to a Windows guy.
    – Tonny
    Apr 28, 2011 at 10:41
  • Appreciate this is an old answer but the %windir%\Windowsupdate.log only seems to show updates for the past month. Perhaps because it's configured to roll off after that time but I'm just pointing out that in some cases not finding it in that log may not indicate it's absent from the system.
    – glaucon
    Jun 28, 2017 at 1:09
1
wmic qfe list /format:htable>C:\PatchList%Computername%.html

Above command will give the output in html format.

0

As someone asked about using wmic at a PowerShell prompt, just use Select-String (or sls).

wmic qfe get hotfixid | sls "KB99999"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .