68

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

jscott
  • 24,204
  • 8
  • 77
  • 99
MathewC
  • 6,877
  • 9
  • 38
  • 53

6 Answers6

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}
jscott
  • 24,204
  • 8
  • 77
  • 99
Skrap
  • 738
  • 6
  • 7
  • 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 '11 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 '16 at 00:31
  • For whatever reason, using "find" is giving me an incorrect format error. Tried single and double quotes. – Scott Sep 22 '16 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. – Mastacheata Jan 10 '18 at 15:11
18

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
HBruijn
  • 72,524
  • 21
  • 127
  • 192
raeez
  • 181
  • 1
  • 2
  • This is not present in v4 – StingyJack May 15 '17 at 13:35
  • It's definitely present in v5.1. And here's the help page: https://docs.microsoft.com/en-gb/powershell/module/Microsoft.PowerShell.Management/Get-HotFix?view=powershell-5.1 – Ant Aug 16 '17 at 14:16
7

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

ccame
  • 1,059
  • 1
  • 11
  • 15
3

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

Tonny
  • 6,252
  • 1
  • 17
  • 31
  • 1
    My Windows didn't come with `grep`. I have to use `find`. – jscott Apr 27 '11 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 '11 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 '17 at 01:09
1
wmic qfe list /format:htable>C:\PatchList%Computername%.html

Above command will give the output in html format.

Jenny D
  • 27,358
  • 21
  • 74
  • 110
vijay
  • 11
  • 1
0

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

wmic qfe get hotfixid | sls "KB99999"

Xopher
  • 101
  • 1