I'm looking to find out if a KB is installed via command line.
Asked
Active
Viewed 2.7e+01k times
6 Answers
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}
-
4How 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
-
-
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.
![](../../users/profiles/29969.webp)
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.
![](../../users/profiles/70964.webp)
Tonny
- 6,252
- 1
- 17
- 31
-
1
-
@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
0
As someone asked about using wmic at a PowerShell prompt, just use Select-String (or sls).
wmic qfe get hotfixid | sls "KB99999"
![](../../users/profiles/481097.webp)
Xopher
- 101
- 1