Powershell Script to find patched and unpatched server!
I have multiple KB’s, I am trying to find whether those KB’s have been patched in those servers.
I have two text file, One contains servers list and other one contains KB list.
Please find my script below.
$computers = Get-Content -path “C:\Temp\Shalomon\MultipleKB\server_list.txt”
$Patch = Get-Content -path “C:\Temp\Shalomon\MultipleKB\kb_list.txt”
foreach ($computer in $computers)
if (get-hotfix -id $Patch -ComputerName $computer -ErrorAction SilentlyContinue)
Add-content “$Patch is Present in $computer” -path “C:\Temp\Shalomon\MultipleKB\Hotfix-Present.txt”
Add-content “$Patch is not Present in $computer” -path “C:\Temp\Shalomon\MultipleKB\Missing-Hotfix.txt”
**************But i get the output as
KB4025337 KB4025252 is Present in vmpip-xxxx
KB4025337 KB4025252 is Present in vmpip-yyyy
KB4025337 KB4025252 is Present in VMPIP-zzzz
Note: I do not get the servers in which the KB’s are missing, Can someone help me out in this code!