#PowerShell Corner: List All Installed KB Articles

By | February 19, 2016

A Quick one today.

Been consulting recently in an environment where the Microsoft patching is not as “current” as it should be (and that’s the polite way of saying it if you catch my drift…)

After some head scratching, I came up with a savvy way of listing out every KB article using a combo of PowerShell (to instantiate a Windows Update object and to enumerate and sort the returned collection)  and REGEX to locate the KB articles amongst all of the other objects returned from the Windows Update object.

Nothing particularly clever here but a couple of noteworthy bits worth calling out.

  • REGEX pattern “KB\d*” means “locate everything that has the letters ‘KB’ and then numbers until you hit a non-numerical character” – simple eh?
  • Using the “Select-String” cmdlet with the -Pattern parameter to dig the KB number out of the name of the update name via the REGEX mentioned above
  • Using the PSObject object type to create an array of the results which can then be manipulated straight to the console or (as in this case) piped out to a CSV file

You can find the script in the usual location here on my GitHub repo.

Usual caveats apply, but enjoy nonetheless!

more to follow…

One thought on “#PowerShell Corner: List All Installed KB Articles

  1. Foxy

    Have used your script to determine Windows Updates but there seems to be a discrepancy between WMIC QFE and or get-hotfix, these show more hotfixes? and your script is not returning the installation date!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *