Author Posts

March 8, 2015 at 2:15 pm

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?


March 8, 2015 at 2:25 pm

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 [i]Learn PowerShell Toolmaking in a Month of Lunches[/i] is pretty much crammed with what you're asking for.

March 9, 2015 at 5:27 pm

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!