Searching for Installed Windows Update With PowerShell

Yesterdays Post Show-WindowsUpdatesLocal does enable you to search for an installed update as follows

Show-WindowsUpdatesLocal|Where-Object {$_.HotFixID -eq ‘KB2855336’} |Select Date, HotfixID, Result,Title|Format-Table –AutoSize

image

I thought I would be able to do it quicker especially if I was searching a server with a lot of updates so I thought I would create a function to answer the  question Is this update installed on that server

It is very similar to Show-WindowsUpdatesLocal but does not include the Title or Description on the grounds that if you are searching for it you should know those!!

It also only adds the output to the collection if the KB is in the HotFixID property as shown below

image

If we use Measure-Command to compare the two we can see

image

image

From 3.89 seconds on my poor overworked machine to 1.79 seconds 🙂

You can find the code here Search-WindowsUpdatesLocal

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s