0

I am just getting started using powershell and i came across am issue. I found someone who was piping their commands through select and grabbing only the properties they need. This also removed any property not needed which, was exactly what i needed. However, i noticed that the different properties i use on one command are applied to another even after changing them in the next command. Any ideas? My code is at the bottom

Write-Output "========================================================"
Get-CimInstance -ClassName Win32_Processor | select -Property Manufacturer, DeviceID, LoadPercentage
Write-Output "========================================================"
Get-CimInstance -ClassName Win32_PhysicalMemory | select -Property  BankLabel, Speed, Tag, PartNumber
Rob
  • 133
  • 3
  • 16
  • that is NOT what is happening. [*sigh ...*] PoSh has a slight delay for things sent to the screen. if they are "the same type" they will be shown in one group ... and if the 2nd item lacks any of the properties found in the 1st item, you will not see any of the 2nd item. ///// you can get around that by adding `| Out-Host` to the end of the pipelines to force PoSh to show it _right now_. – Lee_Dailey Feb 12 '19 at 20:48
  • @AnsgarWiechers - i think you are wrong on "this is a dupe" of that link. the problem is the delayed-output-to-group-similar-types combined with non-overlapping property lists. – Lee_Dailey Feb 12 '19 at 20:51
  • @Lee_Dailey As lined out in my answer to that question. The relevant part is roughly in the middle of my answer, starting at "Beware, however, ...". The question is not an exact duplicate, but my answer there absolutely covers the problem described here (as well as a couple others). – Ansgar Wiechers Feb 12 '19 at 22:50
  • @AnsgarWiechers - i think you are still off-target to mark this as a dupe of that question. part of your _answer_ over there covers this ... but that is an aside to the question asked, not an answer to _this specific_ question. – Lee_Dailey Feb 13 '19 at 01:11
  • 1
    @Lee_Dailey [On meta](https://meta.stackoverflow.com/q/380153/1630171). – Ansgar Wiechers Feb 13 '19 at 10:00

0 Answers0