Convert .NET Framework objects into Comma-Separated Value (CSV) variable-length strings.

      ConvertTo-CSV [[-Delimiter] char]
         [-InputObject] psobject [-NoTypeInformation] [CommonParameters]
      ConvertTo-CSV [-UseCulture]
         [-InputObject] psobject [-NoTypeInformation] [CommonParameters]

   -Delimiter char
       The delimiter to separate property values. Default = 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.

   -InputObject psobject
       The objects to export as CSV strings. Enter a variable that contains the
       objects or type an expression that returns the objects.
       You can also pipe objects to ConvertTo-CSV.

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

       Use the list separator for the current culture as the data delimiter. 
       Default = 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:

       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

ConvertTo-CSV returns a series of comma-separated, variable-length (CSV) strings that represents the objects that you submit.
You can then use ConvertFrom-CSV to re-create objects from the CSV strings.

Export-CSV is the same as ConvertTo-CSV, except that it saves to a file.


Convert a date object to CSV format:

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

Convert a process object to CSV format:

C:\PS> get-process powershell | convertto-csv

Convert an event log object to CSV format:

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

“Drunk with power isn't the same as being drunk with booze” - Craig Ferguson


Export-Csv - Export to Comma Separated Values (spreadsheet)

Copyright © 1999-2017
Some rights reserved