I have a command I run within a pipeline that receives a sequence of computer names. How can I amend that command so that after it I can pipe to select and get the original computer name and whatever it added?
Thanks!
I have a command I run within a pipeline that receives a sequence of computer names. How can I amend that command so that after it I can pipe to select and get the original computer name and whatever it added?
Thanks!
The command would need to output a custom object that included whatever information you want. Or, take whatever object it’s currently outputting, and use Add-Member to add a ComputerName property to that. It’s a little hard to be more specific without seeing some of the actual code, but Learn PowerShell Toolmaking in a Month of Lunches is pretty much crammed with what you’re asking for.
Ahh, you got me sorted.
Piping the first command into `Add-Member -Type NoteProperty -Name PropName -Value $VarToAdd -PassThru` and continuing on got me what I needed.
Much appreciated!