Thursday, May 18, 2017

Powershell script check for MS17-010 and other HotFixes

$hotfixes =  “KB4012212”, “KB4012217”, “KB4015551”, “KB4019216”, “KB4012216”, “KB4015550”, “KB4019215”, “KB4013429”, “KB4019472”, “KB4015217”, “KB4015438”, “KB4016635”

#This variant is for manual entry server names
$Computername = “localhost”

#This variant is for reading from file. Change the filename and fill it with the list of servers/workstations you want to check
#$Computername = Get-Content .\ListOfMachines.txt

foreach ($comp in $Computername) {
$hotfix = Get-HotFix -ComputerName “$Comp”| Where-Object {$hotfixes -contains $_.HotfixID} | Select-Object -property “HotFixID”
if (Get-HotFix | Where-Object {$hotfixes -contains $_.HotfixID})
“Found HotFix on $Comp : ” + $hotfix.HotFixID
} else {
“Didn’t Find HotFix on $Comp”

No comments:

Post a Comment