title: Write to the output between two pipeline
body: <p>I'm trying to write to the output (echo) within two pipe to have a trace of what I'm doing but I have an error.</p>
  
  <pre><code>Get-ChildItem $path -Recurse |
      Where-Object { $_.Name -match '.+?\.log\.(\d{4})-(\d{2})-(\d{2})$' -and $_.LastWriteTime -lt $deleteDate } |
      Write-Output "deleting file" -PassThru |
      Remove-Item
  </code></pre>
  
  <p>but I have this error : </p>
  
  <blockquote>
    <p>Write-Output : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.</p>
  </blockquote>
  
  <p>I also tested in the Foreach-Object function</p>
  
  <pre><code>Get-ChildItem $path -Recurse |
  Where-Object { $_.Name -match '.+?\.log\.(\d{4})-(\d{2})-(\d{2})$' -and $_.LastWriteTime -lt $deleteDate } |
  Foreach-Object {
      echo "deleting $($_.Name)";
      Remove-Item($_);
  } 
  </code></pre>
  
  <p>but here nothing is printed in the console (but the script finish without error and deleted the files I wanted)</p>
  
  <p>So how can I print to thje output wihtin two Pipe ?</p>
  
  <p>Thx</p>