Powershell – How to use PowerShell to check WSUS updates status

powershellwindows-updatewsus

Usually I get a list of Windows updates KB numbers which I have to check the approval status on WSUS server for.

So for me it is very annoying (and time consuming) to open WSUS console and then search for each of it…

Please help me – How to retrieve the WSUS update by KB using PowerShell ?

My idea is to have a script which takes list of KB numbers and for each of the KB numbers tells me if the update is approved (or list the groups to which the update was approved is also acceptable).

Thank you all for helping.

Best Answer

You need install the UpdateServices module which is available since Server 2012:

Import-Module -Name UpdateServices 

Then you can use Get-WsusUpdate

Here is the Microsoft documentation


Example: Use this to get the needed but unapproved critical updates

Get-WsusUpdate -Classification Critical -Approval Unapproved -Status Needed

Example: Check whether KB2952664 is approved:

Get-WsusUpdate -Classification Critical -Approval Approved | where {$_.update.Title -like "*KB2952664*"}