[Question]
  [
# Warning
The answers to this challenge test for a specific version of the patch that helps stop WannaCrypt/WannaCry attacks. Depending on your operating system, you may have a different patch. **The best way to protect yourself is to make sure your PC is fully up to date and be careful when opening attachments and web links.**
---
# Introduction
I like to think programmers are inherently good people, [even if some aren't so nice](http://www.bbc.co.uk/news/technology-39901382), so lets help people make sure they are protected with the [MS17-010 patch](https://technet.microsoft.com/en-us/library/security/ms17-010.aspx).
# Challenge
Your challenge is to write a full program or function that returns a [truthy or falsey](https://codegolf.meta.stackexchange.com/questions/2190/interpretation-of-truthy-falsey?answertab=votes#tab-top) value depending on if the MS17-010 patch is installed on the current operating system.
# Input and Output
Input: No input required
Output: A truthy or falsey value (Indicate which is used for each case).
An error/exception can be considered a falsey value.
# Rules
* Your code should run (and output correctly) on at least one windows operating system for which the patch is available, but doesn't have to run on every operating system (Please state any limitations).
* [Standard loopholes apply](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default)
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the submission with the least amount of bytes wins!
  
[Answer]
# PowerShell 2.0, ~~24~~ ~~20~~ 16 bytes
```
hotfix KB4012212
```
-4 bytes thanks to *@whatever* by removing  `-id`.  
-4 bytes thanks to *@DankoDurbić* by changing `get-hotfix` to `hotfix`.
`KB4012212` is the patch for Windows 7. This can be replaced with any KB-code from [the linked page of the patch](https://technet.microsoft.com/en-us/library/security/ms17-010.aspx).
Will return the *Source*, *Description*, *HotFixID*, *InstalledBy* and *InstalledOn* information when it's installed as truthy value, and will give an error if it's unable to find it as falsey value.
Here is an example of both a truthy and falsey output (so `KB4012212` is installed on my machine, but `KB4012215` is not):
[![enter image description here](https://i.stack.imgur.com/7jEvs.png)](https://i.stack.imgur.com/7jEvs.png)
[Answer]
# Batch / Windows CMD, ~~31~~ ~~29~~ ~~28~~ 23 bytes
```
wmic qfe|find "4012212"
```
-1 byte thanks to *@SteveFest* by changing `findstr 4012212` to `find "4012212"`.  
-5 bytes thanks to *@BassdropCumberwubwubwub* by removing  `list`.
**Explanation:**
```
wmic          Windows Management Instrumentation Command-line
qfe           Quick Fix Engineering
|find "..."   Looks for the string in the complete output
```
Outputs some patch info if it's installed, or nothing otherwise.  
In the screenshot below, patch `4012212` is installed, and `4012215` is not.
[![enter image description here](https://i.stack.imgur.com/kHEgS.png)](https://i.stack.imgur.com/kHEgS.png)
[Answer]
## Bash + Cygwin (Or WSL), 21 bytes
This answer is mostly stolen from Kevin's [answer](https://codegolf.stackexchange.com/a/120793/36915). So throw an upvote that way also if you think this deserves one.
```
wmic qfe|grep 4012212
```
Cygwin has access to the Windows commands in addition to coreutils. We are able to use coreutils's `grep` instead of Windows's `find` so we don't need to use quotes. 2 bytes are saved because of this.
[Answer]
## Powershell 5.1, 245 212 207 bytes
```
$S=New-Object -ComObject Microsoft.Update.Session;$T=$S.CreateUpdateSearcher();$H=$‌​T.GetTotalHistoryCo‌​unt();$p=0;$T.Query‌​History(0,$H)|ForEa‌​ch-Object -Process{if($_.Title -like"*KB4013429*"){$p=1;}};echo $p;
```
-33 bytes thanks to @KevinCruijssen removing white space and replacing true and false with 1 and 0.
-5 bytes thanks to @KevinCruijssen shortening variable names
Obviously not going to win any prizes, but this powershell script will check the Microsoft Update history log for KB4013429 (one of the patches listed on the [link](https://technet.microsoft.com/en-us/library/security/ms17-010.aspx)) it can be replaced with any of the patches. Thought I'd post it because it's a little more reliable if the patch has been replaced with a later one.
[Answer]
## C#, ~~178~~ ~~143~~ ~~141~~ 134 bytes
```
_=>new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_QuickFixEngineering WHERE HotFixID='KB3150513'").Get().Count>0;
```
Compiles to a `Func<int, bool>` where the input is unused.
*Saved 35 bytes with the help of @Ryan*  
*Saved 2 bytes thanks to @KevinCruijssen*  
*Saved 7 bytes thanks to @ErikKarlsson*
Formatted version:
```
System.Func<int, bool> f = _ =>
    new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_QuickFixEngineering WHERE HotFixID = 'KB3150513'")
                         .Get().Count > 0;
```
[Answer]
# Cygwin, 31 bytes
Just to play the rebel
```
grep KB4012212 "$WINDIR"/*e.log
```
the return code will be 0 if the patch has been applied, or 1 if it hasn't.
Tested under Windows 7 with Cygwin 2.6.0
[Answer]
## PowerShell v4, 64 bytes
```
HotFix|? HotFixID -m "401(221[2-7])|(2598)|(2606)|(3198)|(3429)"
```
Checks for all KB refs using a RegEx (now you have two problems)
[Answer]
# Batch/Command Prompt, ~~**27**~~ 25 bytes
```
systeminfo|find "4012212"
```
If KB4012212 is found output that, otherwise nothing is outputted.
Thanks to @Kevin for saving 2 bytes :)
[Answer]
# Powershell 2.0, 142 bytes
* Returns 0 for "false", not patched" < 0 for "true", patched.
Below contains all KB's from March, but needs expanded with April, May KB's as each supersedes all previous.
```
(Get-HotFix | where HotFixID -match "4012598","4012216","4012213","4012217","4012214","4012215","4012212","4013429","4012606","4013198").Count
```
[Answer]
## Powershell 5.1 134 Bytes
Same as Mark Pippin's but changed the Get-Hotfix to Hotfix and where to ? saving 8 bytes
```
(HotFix | ? HotFixID -match 
 "4012598","4012216","4012213","4012217","4012214","4012215","4012212","4013429","4012606","4013198").Count
```
I can't get it lower in byte-count than Kevin's answer
[Answer]
# [DISM](https://technet.microsoft.com/en-us/library/hh825236.aspx), 40 bytes
```
dism/online /get-packages|find "4012212"
```
**Explanation:**
```
dism             Deployment Image Servicing and Management command-line
/online          Look at current running PC's Operating System
/get-packages    Display some basic information about all packages in the image
|find "..."      Looks for the string in the complete output
```
Outputs the package identity if it's installed, or nothing otherwise.  
In the screenshot below, patch `4012212` is installed, and `4012215` is not.
[![enter image description here](https://i.stack.imgur.com/oJzYF.png)](https://i.stack.imgur.com/oJzYF.png)
]