Check Hotfix with PowerShell

This script allows to check if a KB (Hotfix) is installed on a machine.

The Cmdlet to use is Get-Hotfix.

The Get-Hotfix cmdlet gets hotfixes (also called updates) that have been installed on either the local computer (or on specified remote computers) by Windows Update, Microsoft Update, or Windows Server Update Services; the cmdlet also gets hotfixes or updates that have been installed manually by users.

TechNet: https://technet.microsoft.com/fr-fr/library/hh849836(v=wps.620).aspx

 

If (Get-Hotfix -id KB3022345) {
    Write-Host "The KB KB3022345 is installed on the machine"		
}
Else {
	Write-Host "The KB KB3022345 is NOT installed on the machine"
}