Request an overview of installed Microsoft Hotfixes using Powershell

One of my customers requested a overall view of the servers where one or more Microsoft Hotfixes were installed. I’ve used a small and simpel PowerShell script to do that.

This scripts uses a text file (serverlist.txt) to check which servers it needs to use to look for the Hotfix(es). Place each server ona  different line. I have placed the text file on d:\ServerLixt.txt. Use it like this:

server1
server2
server3
..etc

GetHotfix.ps1 generates a overview of installed hotfixes (in this case KB2486635) on the requested servers.

$Servers = Get-Content 'd:\ServerList.txt'
 
Invoke-Command -ComputerName $Servers -ScriptBlock {
    $Result = Get-Hotfix | where {$_.hotfixid -eq 'KB2486635'}
    if ($Result) {
        New-Object PSObject -Property @{Host = hostname; Value = $true}
    } else {
        New-Object PSObject -Property @{Host = hostname; Value = $false}
    }
}

Looking up multiple hotfixes is possibile to extend the script with multiple ‘KB12345678’. For more information about the Get-Hotfix command: slook here.