Number of outstanding Windows-Updates

I need to store the number of outstanding Windows-Updates in a variable. So far I have:

Import-Module PSWindowsUpdate 
(Get-WindowsUpdate -AcceptAll -NotCategory "Drivers" | format-table -HideTableHeaders | Out-String).Trim() | Measure-Object -Line

How to transfer the result (in my case : 1) into a variable?

Thanks - Michael

You’re in PowerShell now … you work with objects and porperties now … you need to change how to think … :wink:

$Result = Get-WindowsUpdate -AcceptAll -NotCategory 'Drivers'
$Result.Count

:point_up_2:t4: Format cmdlets like Format-Table or Format-List and so on should always be very last the cmdlet in a pipeline and in the vast majority of the cases it does not make sense to pipe their output to any further cmdlet. They are meant to be used for console output only. :point_up_2:t4:

1 Like

Thanks and I totally agree: Being an old-fashioned developer (FORTRAN, VB, Batch …) it is “a little bit” challenging to switch to OO-thinking. But I am pon the way - (hopefully).

Michael