4

I have WSUS installed on a Server 2012R2 box. I am trying to use the Get-WsusComputer powershell command to get a list of computers with pending or failed updates. The documentation for the command seems to suggest that -ComputerUpdateStatus is the correct option for this.

-ComputerUpdateStatus Specifies the computer update state as represented in the WSUS Console user interface. The acceptable values for this parameter are: ...

The problem I am having is that using this option doesn't seem to make any difference. When I look at the console in the GUI about 75% of my systems are in the OK state, a few have been offline for a while, a few have failures, and the rest show a couple 1-2 updates in the needed column.

PS D:\> get-wsuscomputer -ComputerTargetGroups Workstations | Measure-Object

Count    : 264

PS D:\> get-wsuscomputer -ComputerTargetGroups Workstations `
>>                  -ComputerUpdateStatus Failed  | Measure-Object

Count    : 264

PS D:\> get-wsuscomputer -ComputerTargetGroups Workstations `
>>                  -ComputerUpdateStatus FailedOrNeeded | Measure-Object

Count    : 264

Is this option simply broken? Or am I missing something obvious about how to use it?

10

2 Answers 2

3

There is a bug in the WSUS PowerShell Module. I decompiled Module and the GetWSUSComputer command looks like somebody defaulted a variable to all statuses if null even though the variable hadn't had a value defined until the next line. The design of the module doesn't expose the Computer Update status in the object Get-WSUSComputer exposes so you can't filter it after the fact either.

1

Here is the article describing everything you are interested in.

https://blogs.technet.microsoft.com/heyscriptingguy/2012/01/20/get-windows-update-status-information-by-using-powershell/

I have tried out some of the code from this article, it works pretty well. Please note that there is a typo at:

$wsus.GetUpdateStatue($updatescope,$False)

it should be:

$wsus.GetUpdateStatus($updatescope,$False)
2
  • Right, like I said, when somebody posted in the comments this method seems to work. But I am frustrated that the Powershell Commandlets that seem claim they have the functionality, don't work. Not saying your answer isn't useful for getting the job done. It just isn't as easy of a job, since you have to use .NET stuff instead of pure powershell.
    – Zoredache
    Aug 25, 2016 at 16:41
  • I completely agree with you. This should be powershell out-of-the-box feature Aug 25, 2016 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .