Author Posts

September 2, 2016 at 3:10 pm

Chapter 6 lab, "Learning Powershell in a month of lunches" asks the question "5. Is there a way to eliminate the # comment line from the top of an exported CSV file? That line normally contains type information, but what if you wanted to omit that from a particular file?" but provides no answer. Anyone?

September 2, 2016 at 3:18 pm

You can provide the parameter -NoTypeInformation to the cmdlets ConvertTo-Csv and Export-Csv.

$data | ConvertTo-Csv -NoTypeInformation
$data | Export-Csv -Path C:\test.csv -NoTypeInformation

September 2, 2016 at 4:50 pm

The goal was to have you read the help for the command and discover that on your own :). Meant to be empowering.

September 2, 2016 at 5:37 pm

Thanks Don. Your comment in the book about reading the help ran through my mind after I posted it. And yet I'm not sure what to type after Get-Help.

  • This reply was modified 2 years ago by  Jim.

September 2, 2016 at 6:46 pm

I went back through the chapters and don't see where we covered -NoType or how to Get-Help on a switch

  • This reply was modified 2 years ago by  Jim.

September 5, 2016 at 10:52 am

try

Get-help Export-Csv -full

Read the whole entry – especially what each of the parameters do

Its actually a good idea to read through the help for any new cmdlet you come across to make sure you understand how it works an what your choices are

September 5, 2016 at 1:00 pm

Excellent suggestion, Richard. Thanks very much.

Honestly I should add something similar to every post as a signature.

September 6, 2016 at 12:35 pm

I personally prefer a web based view:

Get-help Export-Csv -Online