#PowerShell - Export-CSV without the Comma - Changing Delimiters
One of my favorite parts of my job is the regular need to gather and conform data. Actually it can be a real pain sometimes but it’s usually an interesting challenge. I came across this issue several months ago when trying to generate a function that would format the data output so that it could be imported into another tool. I can’t go into specifics about this but I can highlight something really cool I learned.
The data output needed to be in tab delimited format. Clearly this is a common form since it is the default option when importing data into Excel.

Unfortunately I did not see an Export-TSV cmdlet so I poked around at how I might go about creating this output. Thankfully I ran Get-Help against Export-CSV and lo and behold!

But wait! There’s a stipulation!

So it appears that a character is required in order to use a specialized delimiter! Well that makes since but how am I supposed to use a tab then? I pulled out my handy sonic screwdriver and pointed it at the internet. It grabbed a list of the special characters recognized by PowerShell. [Note: I wish I did have a sonic screwdriver.]
The following special characters are recognized by Windows PowerShell:
`0 Null
`a Alert
`b Backspace
`f Form feed
`n New line
`r Carriage return
`t Horizontal tab
`v Vertical tab
These characters are case-sensitive.
from <http://technet.microsoft.com/en-us/library/dd347558.aspx>
Looks like `t is the one I’m looking for so I plugged it into a test one-liner for validation.
Get-Process | Export-Csv -Delimiter “`t” -Path “C:\Temp\TabTest.txt” -NoTypeInformation

Worked like a charm. We’ve since used that function for many things in order to grab information and pull it into our application. Now our PowerShell/PowerCLI scripting initiatives fall right in line with existing tools and has made adoption that much easier! I think I would have made PowerCLI Man proud!