Passing data along pipeline

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Ritmo2k Ritmo2k 1 year, 9 months ago.

  • Author
    Posts
  • #23136
    Profile photo of Ritmo2k
    Ritmo2k
    Participant

    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!

  • #23137
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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.

  • #23166
    Profile photo of Ritmo2k
    Ritmo2k
    Participant

    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!

You must be logged in to reply to this topic.