Removing the first line (#TYPE) when using Export-csv cmdlet

Share this:

Hello my friends,

If you export data from Exchange you may have already noticed that after exporting data you will have a first line which by default starts with #TYPE and then specifies the object (full qualified).

If you are not sure we can show you the issue in a couple of steps. First Let’s get a list of all our mailboxes and then export to the file OUTemp.csv

image

If we open the file, here we have the first line with the information.

image

It’s not a big deal but when you open on Excel instead of having your columns ready to rock and roll you have to go there and delete the line.

image

The solution..

The solution can be found in the export-csv cmdlet by using the switch –NoTypeInformation as show in the figure below.

image

Now, as result we can open the CSV file generated by the previous cmdlet and voilà we don’t have that line.

image

Written by Anderson Patricio

Anderson Patricio

Anderson Patricio is a Canadian MVP in Cloud and Datacenter Management, and Office Server and Services, besides the Microsoft Award he also holds a Solutions Master (MCSM) in Exchange and several other certifications. Anderson has been contributing to the Microsoft Community with articles, tutorials, blog posts, twitter, forums and book reviews. He is a regular contributor here at ITPROCentral.com, MSExchange.org, Techgenix.com and Anderson Patricio.org (Portuguese).