usr-local-bin
usr-local-bin

Reputation: 43

How would I select the KB numbers in the output of the Get-WindowsUpdate command?

PS C:\Windows\system32> Get-WindowsUpdate

ComputerName Status     KB          Size Title
------------ ------     --          ---- -----
computer     -------    KB890830     2MB Windows Malicious Software Removal Tool x64 - February 2020 (KB890830)
computer     -------    KB4537759   21MB 2020-02 Security Update for Adobe Flash Player for Windows 10 Version 1909 for x64-based Systems (KB4537759)
computer     -------    KB2267602  607MB Security Intelligence Update for Windows Defender Antivirus - KB2267602 (Version 1.309.835.0)
computer     -------    KB4532693   84GB 2020-02 Cumulative Update for Windows 10 Version 1909 for x64-based Systems (KB4532693)

I have tried Get-WindowsUpdate | Select-Object KB, but it just returns the following:

KB
--

Upvotes: 0

Views: 1042

Answers (2)

js2010
js2010

Reputation: 27606

This is from the PSWindowsUpdate module. You have to run it elevated too, yuck. It seems to return collections you have to unravel:

(get-windowsupdate | select -first 1).gettype()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     Collection`1                             System.Object


get-windowsupdate | foreach { $_ } | select kb

KB
--
KB890830
KB2267602

Upvotes: 1

CraftyB
CraftyB

Reputation: 746

If you are using powershell version 3 or above you can get KB by calling the member directly:

(Get-WindowsUpdate).KB

Which will return:

KB890830
KB4537759
KB2267602
KB4532693

Upvotes: 1

Related Questions