Get only values (not title) and put it in to a header

Arosh Wijepala 161 Reputation points
2021-05-24T12:29:00.247+00:00

Hi,

I'm using below code to get installed Windows update on a device in the last 120 days.

Get-CimInstance -Class win32_quickfixengineering | Where-Object { $_.InstalledOn -gt (Get-Date).AddDays(-120) } | Select-Object -Property HotFixID

The result is below.

HotFixID
--------
KB4601050
KB4562830
KB4598481
KB4598242

I want to remove the HotFixID title and only get the KB values and put them in to an array.

I appreciate any help to get this working. Thanks in advance.

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 36,401 Reputation points
    2021-05-24T13:19:46.327+00:00
    (Get-CimInstance -Class win32_quickfixengineering | Where-Object { $_.InstalledOn -gt (Get-Date).AddDays(-120) } | Select-Object -Property HotFixID).HotFixID 
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Andreas Baumgarten 123.6K Reputation points MVP Volunteer Moderator
    2021-05-24T13:34:04.503+00:00

    Hi @Arosh Wijepala ,

    pleas try this

    $a = Get-CimInstance -Class win32_quickfixengineering | Where-Object { $_.InstalledOn -gt (Get-Date).AddDays(-0) } | Select-Object -Property HotFixID  
    $a.GetType()  
    $a.HotFixID  
    $a | Format-Table -HideTableHeaders  
    

    $a.GetType() shows $a is an array

    $a.HotfixID shows just the values
    The Format-Table -HideTableHeaders shows the table content without header

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.