Repeat the csv header twice without "Append" (PowerShell 1.0)

Posted by Mark on Server Fault See other posts from Server Fault or by Mark
Published on 2014-08-25T07:13:51Z Indexed on 2014/08/25 10:21 UTC
Read the original article Hit count: 183

Filed under:
|

I have prepared a PowerShell script to export a list of system users in CSV format. The script can output the users list with Export-csv with single header row (the header row at top).

However my requirement is to repeat the header row twice in my file. It is easy to achieve in PowerShell 3.0 with "Append" (e.g. $header | out-file $filepath -Append) Our server envirnoment is running PowerShell 1.0. Hence I cannot do it. Is there any workaround? I cannot manually add it myself.

Thank you.

© Server Fault or respective owner

Related posts about powershell

Related posts about csv