I apologize for the very basic question.
Consider "Learn PowerShell Toolmaking in a Month of Lunches" or "The PowerShell Scripting & Toolmaking Book" as very valuable in getting you on the right path in this regard. You're perilously close to heading on the Dark Path of Painfulness 🙂 because PowerShell isn't like most other languages.
You want to use New-Object to create a new PSObject, and then populate it with properties for Name, Age, etc. You want to Write-Output that to the pipeline, one object at a time, so that the pipeline can carry the objects to the next command. That next command can use pipeline parameter binding to "pick up" the objects and process them however it needs.
Either of the two above books will really put you on the Light Path of Righteousness and do a lot to help you understand how PowerShell "wants" to do this kind of thing.
You must be logged in to reply to this topic.