February 2019
Intermediate to advanced
626 pages
15h 51m
English
The Export-Csv command writes data from objects to a text file, for example:
Get-Process | Export-Csv processes.csv
By default, Export-Csv will write a comma-delimited file using ASCII encoding and will completely overwrite any file using the same name.
Export-Csv may be used to add lines to an existing file using the Append parameter. When the Append parameter is used, the input object must have each of the fields listed in the CSV header or an error will be thrown unless the Force parameter is used:
PS> Get-Process powershell | Select-Object Name, Id | Export-Csv .\Processes.csvPS> Get-Process explorer | Select-Object Name | Export-Csv .\Processes.csv -AppendExport-Csv : Cannot append CSV content to the following ...
Read now
Unlock full access