Tech Tip: How to check Windows Patch against WannaCry using powercli

Another time we are hearing about a worldwide attack using a ransomware to stole money (bitcoins) and create services unavailability or data losses. One question in many company is asked to IT department :- Are we protect against this attack?-

It’s know that this attack, like the major part of the attacks, is permitted due a security bugs in Windows systems. For this reason, last month, Microsoft made available a patch to avoid this attack. But how many people already have updated their system?

You know, sometimes is difficult for many IT department to find the right time to apply updates and patches, because in 99% of cases it requires a reboot, with consequent unavailability or dependency problems. Answering the question for protection, if you’re in a VMware farm with many windows VMs in a domain controller, you could take the advantage of the powercli to getting the state of windows update for every window VM.

A note from Microsoft is released with its KBID: https://support.microsoft.com/en-us/help/4013389/title

Requirements

  • an vCenter account with enough privileges to execute a script using Invoke-VM script
  • an active directory administrator account (or with enough privileges) to execute Get-HotFix command
  • powercli (of course!)

The Script

Here the example:

For newbie in powercli, before launching the script you must connect to vCenter using the cmdlet Connect-VIServer. Hope this could be useful!