question

phantom2000-5377 avatar image
0 Votes"
phantom2000-5377 asked AndreasBaumgarten answered

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

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-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MotoX80 avatar image
0 Votes"
MotoX80 answered
 (Get-CimInstance -Class win32_quickfixengineering | Where-Object { $_.InstalledOn -gt (Get-Date).AddDays(-120) } | Select-Object -Property HotFixID).HotFixID 
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered

Hi @phantom2000-5377 ,

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


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.