PowerTip: Maintain PowerShell Objects

Summary: Maintain Windows PowerShell objects in the pipeline.

Hey, Scripting Guy! Question How can I send output to the Windows PowerShell pipeline without changing the formatting or objects, plus
           insure that the output go to the Windows PowerShell console if there is nothing else in the pipeline?

Hey, Scripting Guy! Answer The Write-Output cmdlet sends output to the pipeline or to the console if it is the last command in the pipeline:

Get-Process | Write-Output

Comments (2)

  1. PetSerAl says:

    Write-Output actually change objects. It enumerates collections.

Skip to main content