Currently teaching myself PS using a couple of different resources, one of which is the oft recommended books Learn PS in a Month of Lunches. I am currently halfway through Chapter 9, entitled The Pipeline, deeper. However, as I’ve begun working my way through Chapter 9, I’ve realized I need to solidify my understanding of some of the concepts in Chapter 8, which introduces objects. I am hoping I can get the answers I need here.
The first thing I’d like to clarify is that my understanding of an object is correct. If I run
Get-Process in the shell, it outputs a table listing the various processes row-by-row. It is my understanding that each one of those listed processes is a distinct object, and therefore, each row in the table represents a distinct object. Is this correct? And if this is correct, is it fair to say that an object is really just a collection of properties relating to a given entity (in this case, a given process)?
Assuming my understanding of objects is correct, I’d like to investigate an example the authors of the book use to explain how objects move through the pipeline. The example used is pertaining to this command:
Get-Process | Gm | Gm
When I run this command, PS will go out and grab the full list of every single process running on the computer, with each one of these processes representing a discreet object. The entire sum of these discreet process objects is referred to as a collection. PS in fact passes this entire collection through the pipeline to the first
Gm command. The first
Gm command outputs the following abbreviated information:
At the top of this output, we have this thing called TypeName. Is TypeName effectively just the object type (in this case, a process object) being associated with the outputted list of members? And are each one of those members also objects while at the same time being the process objects’ properties, methods, etc. (or simply, it’s corresponding members)?
If all that is correct, then if we run the whole command
Get-Process | Gm | Gm the member objects of the process object would be what actually gets piped from the first
Gm commandlet to the second
Gm commandlet. So we’d have the following flow:
Process Object → Gm, Gm produces list of process member objects (MemberDefinition objects); then, Process Member Objects (MemberDefinition objects ) → Second Gm, Second GM produces list of members associate with a MemberDefintion object.
Is this correct? Just want to make sure in my own words that I’m understanding things. Thanks!