Quantcast
Channel: automate – SQL DBA with A Beard
Viewing all articles
Browse latest Browse all 50

Searching for Installed Windows Update With PowerShell

$
0
0

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



Viewing all articles
Browse latest Browse all 50

Trending Articles