Export a powershell object to a comma-separated values (CSV) file.
Syntax Export-CSV [[-Delimiter] char] [-Path] string -InputObject psobject [-Encoding string] [-Force] [-NoClobber] [-NoTypeInformation] [-Confirm] [-WhatIf] [CommonParameters] Export-CSV [-UseCulture] [-Path] string -InputObject psobject [-Encoding string] [-Force] [-NoClobber] [-NoTypeInformation] [-Confirm] [-WhatIf] [CommonParameters] Key: -Delimiter char 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. -Encoding string The encoding for the exported CSV file. Valid values are: Unicode, UTF7, UTF8, ASCII, UTF32, BigEndian unicode, Default, and OEM. The default is ASCII. -Force Overwrite the file specified in path without prompting. -InputObject psobject 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 Export-CSV. -NoClobber Do not overwrite (replace the contents) of an existing file. By default, Export-CSV will overwrite any existing file without warning. -NoTypeInformation Omit the type information from the CSV file. By default, the first line of the CSV file contains "#TYPE " followed by the fully-qualified name of the type of the .NET Framework object. -Path string The path to the CSV output file. (required) -UseCulture Use the list separator for the current culture as the item delimiter. The default is a comma (,). This is 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. -whatIf Describe what would happen if you executed the command without actually executing the command. -confirm Prompt for confirmation before executing the command. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.
Select a few properties from the wmiprvse process and export them to a CSV format file:
PS C:> get-process wmiprvse | select-object basePriority,ID,SessionID,WorkingSet | export-csv -path data.csv
Export objects representing the processes on the computer to Processes.csv (comma separated):
PS C:> get-process | export-csv E:\processes.csv
Export objects representing the processes on the computer to Processes.csv (semicolon separated):
PS C:> get-process | export-csv E:\processes.csv -Delimiter ";"
Export objects representing the processes on the computer and use -NoTypeInformation to suppress the type information in the output file:
PS C:> get-process | export-csv E:\processes.csv -NoTypeInformation
“Try not to become a man of success but rather to become a man of value” ~ Albert Einstein
import-csv - Take values from a CSV list and send objects down the pipeline.
export-clixml - Produce a clixml representation of powershell objects
import-clixml - Import a clixml file and rebuild the PS object
convertTo-Html - Convert the input into an HTML table
© Copyright SS64.com 1999-2013
Some rights reserved