Table of contents


JuanPablo Jofre|Last Updated: 3/6/2017
4 Contributors


Converts objects into a series of comma-separated value (CSV) variable-length strings.


Delimiter (Default)

ConvertTo-Csv [-InputObject] <PSObject> [[-Delimiter] <Char>] [-NoTypeInformation] [<CommonParameters>]


ConvertTo-Csv [-InputObject] <PSObject> [-UseCulture] [-NoTypeInformation] [<CommonParameters>]


The ConvertTo-CSV cmdlet returns a series of comma-separated (CSV) strings that represents the objects that you submit. You can then use the ConvertFrom-CSV cmdlet to re-create objects from the CSV strings. The resulting objects are CSV versions of the original objects that consist of string representations of the property values and no methods.

You can also use the T:Microsoft.PowerShell.Commands.Export-Csv and T:Microsoft.PowerShell.Commands.Import-Csv cmdlets to convert objects to CSV strings (and back). Export-CSV is the same as ConvertTo-CSV, except that it saves the CSV strings in a file.

You can use the parameters of the ConvertTo-CSV cmdlet to specify a delimiter other than a comma or to direct ConvertTo-CSV to use the default delimiter for the current culture.

For more information, see Export-CSV, and see the Notes section.


Example 1

PS C:\> get-process powershell | convertto-csv
#TYPE System.Diagnostics.Process
rshell.exe","Microsoft Corporation","3.4788223","6.1.6587.1 (fbl_srv_powershell(nigels).070711-0102)","6.1.6587.1","Win
dows PowerShell","Microsoft® Windows® Operating System","8",,"False",,"860","216","5132",".","5636936","Windows PowerSh
ell 2.0 (04/17/2008 00:10:40)","System.Diagnostics.ProcessModule (powershell.exe)","1413120","204800","System.Diagnosti
"System.Diagnostics.ProcessStartInfo","4/21/2008 3:49:19 PM",,"System.Diagnostics.ProcessThreadCollection","00:00:03.51

This command converts a single process object to CSV format. The command uses the Get-Process cmdlet to get the PowerShell process on the local computer. It uses a pipeline operator (|) to send the command to the ConvertTo-CSV cmdlet, which converts it to a series of comma-separated strings.

Example 2

PS C:\> $date = get-date
PS C:\> convertto-csv -inputobject $date -delimiter ";" -notypeinformation

This example converts a date object to CSV format.

The first command uses the Get-Date cmdlet to get the current date. It saves it in the $date variable.

The second command uses the ConvertTo-CSV cmdlet to convert the DateTime object in the $date variable to CSV format. The command uses the InputObject parameter to specify the object to be converted. It uses the Delimiter parameter to specify the delimiter that separates the object properties. It uses the NoTypeInformation parameter to suppress the #TYPE string.

Example 3

PS C:\> get-eventlog -log "windows powershell" | convertto-csv -useculture

This command converts the Windows PowerShell event log on the local computer to a series of CSV strings.

The command uses the Get-EventLog cmdlet to get the events in the Windows PowerShell log. A pipeline operator (|) sends the events to the ConvertTo-CSV cmdlet, which converts the events to CSV format. The command uses the UseCulture parameter, which uses the list separator for the current culture as the delimiter.



Specifies a delimiter to separate the property values. The default is a comma (,). Enter a character, such as a colon (:).

To specify a semicolon (;), enclose it in quotation marks. Otherwise, it will be interpreted as the command delimiter.

Type: Char
Parameter Sets: Delimiter

Required: False
Position: 2
Default value: , (comma)
Accept pipeline input: False
Accept wildcard characters: False


Specifies the objects to export as CSV strings. Enter a variable that contains the objects or type a command or expression that gets the objects. You can also pipe objects to ConvertTo-CSV.

Type: PSObject
Parameter Sets: (All)

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False


Omits the type information header from the output. By default, the string in the output contains "#TYPE " followed by the fully-qualified name of the object type.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: NTI

Required: False
Position: Named
Default value: #TYPE <Object>
Accept pipeline input: False
Accept wildcard characters: False


Uses the list separator for the current culture as the data delimiter. The default is a comma (,).

This parameter is very useful in scripts that are being distributed to users worldwide. To find the list separator for a culture, use the following command: (Get-Culture).TextInfo.ListSeparator.

Type: SwitchParameter
Parameter Sets: UseCulture

Required: False
Position: Named
Default value: Comma
Accept pipeline input: False
Accept wildcard characters: False


This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (



You can pipe any object that has an Extended Type System (ETS) adapter to ConvertTo-CSV.



The CSV output is returned as a collection of strings.


  • In CSV format, each object is represented by a comma-separated list of its property value. The property values are converted to strings (by using the ToString() method of the object), so they are generally represented by the name of the property value. ConvertTo-CSV does not export the methods of the object.

    The format of the resulting CSV strings is as follows:

    • The first string consists of '#TYPE ' followed by the fully-qualified name of the object type, such as #TYPE System.Diagnostics.Process. To suppress this string, use the NoTypeInformation parameter.

    • The next string represents the column headers. It contains a comma-separated list of the names of all the properties of the first object.

    • The remaining strings consist of comma-separated lists of the property values of each object.

  • When you submit multiple objects to ConvertTo-CSV, ConvertTo-CSV orders the strings based on the properties of the first object that you submit. If the remaining objects do not have one of the specified properties, the property value of that object is null, as represented by two consecutive commas. If the remaining objects have additional properties, those property values are ignored.




© 2017 Microsoft