by Rich Rousseau
9. January 2009 07:36
Recently I needed to know if a particular windows patch was installed on my machine. I went to Add/Remove Programs and checked the "Show Updates" option, but the list there was too long and my eyes too tired to try and scan them all manually. I thought this should be an easy task for PowerShell, but I didn't know how to access a list of installed updates. I decided WMI would be a good place to start and did quite a few searches using "Get-WmiObject -List". I queried a few different providers that I thought would list them, but I wasn't getting anywhere. I'm sure there is a WMI Provider that lists all windows updates, but couldn't find it.*
Luckily, a
coworker of mine who I had been discussing this with helped immensely when he pointed me to a
script that would list all installed software. The script uses a registry entry that lists all "uninstallable" software. I knew I could easily search the registry using PowerShell and set about looking for my particular update with the following...
dir HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | where {$_.Name -Like '*kb956391*'}
*I have since found that Win32_QuickFixEngineering will list all windows hotfixes…
Get-WmiObject -Query 'select * from Win32_QuickFixEngineering' | where {$_.HotFixID -eq 'KB956391'}