It seems that the script output repeats the header line for each item in the pipeline. In case of "dir c:\windows | out-tempfile" it actually prints multiple lines before each item.
It is not obvious why. I tried debugging the script and each items comes without the header line (s).
Thank you
Alex.