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 is a Canadian Exchange Server MVP and MCSM (Solutions Master) and he contributes to the Microsoft Community with articles, tutorials, blog posts, forums and book reviews. He is a regular contributor at MSExchange.org, ITPROCentral.com and AndersonPatricio.org (Portuguese).