61

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

64

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}
  • 3
    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 0: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
17

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
6

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.

  • 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 1:09
0
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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.