Querying WSUS with Powershell

Out of the box, WSUS is capable of reporting update status in a number of permutations, but I always seem to need some combination that I can’t easily derive using the GUI.

I recently needed to determine the status of a particular update (KB958644) for a number of computers that spanned different WSUS groups. I knew that there was a .NET API for WSUS management and so Powershell seemed to the most appropriate tool to use. I found this script example which got me started.

After a bit of head scratching I came up with the script below. It reads a list of computer names from a plain text file (Computers.txt) and calls the GetUpdateStatus function for each computer listed, passing the computer name and update string to the function.

The GetUpdateStatus function pulls the computer object from WSUS and then attempts to locate the update specified by the string. The status of the update is then returned.

Leave a Reply

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