title: Powershell Import-CSV: either reorder columns with no headers or export-CSV with no header
body: <p>I have a CSV file with no headers in which I need to add a column between the first and second column. I ultimately want to export the file with no headers to the same file name (hence why I'm using Import-CSV vs Get-Content).</p>
  
  <p>Here is the script which adds the new column to the existing file:</p>
  
  <pre><code>(Import-CSV U:\To_Delete\Layer_search\WB_layers-mod.csv) | 
  Select-Object *,@{Expression={'FALSE'}} |
  Export-Csv U:\To_Delete\Layer_search\WB_layers-mod.csv -NoTypeInformation
  </code></pre>
  
  <p>This adds the a new column as a third column. In doing my googling, I could find no way to reorder the columns without having a header row, so I modified the script as follows:</p>
  
  <pre><code>(Import-CSV U:\To_Delete\Layer_search\WB_layers-mod.csv -header H1, H2)| 
  Select-Object *,@{Name='H3';Expression={'FALSE'}} |
  Select-Object -Property H1, H3, H2 |
  Export-Csv U:\To_Delete\Layer_search\WB_layers-mod.csv -NoTypeInformation
  </code></pre>
  
  <p>This puts the columns in the correct order, but now I want to export the CSV without the header row I added. However, the only suggestions I'm finding are using Get-Content, Convert-to-CSV, and using Skip 1. That won't work for me because I'm only running PS3 and that option is not available until PS5, and I want to save back to the original file name, which you can't do with Get-Content.</p>
  
  <p>I'm probably making this a lot harder than it needs to be, but I would appreciate any suggestions.</p>
  
  <p>Thanks!</p>
  
  <p><strong>Edited to add</strong>:</p>
  
  <p>For clarification, here is an example of the CSV file I am importing:</p>
  
  <pre><code>abc,1/1/2012
  def,1/2/2012
  ghi,1/3/2012
  </code></pre>
  
  <p>I want to add a column between the first and second columns:</p>
  
  <pre><code>abc,FALSE,1/1/2012
  def,FALSE,1/2/2012
  ghi,TRUE,1/3/2012
  </code></pre>
  
  <p>Hopefully this makes more sense.</p>