Export-CSV converts PowerShell objects into comma-separated values and writes them to a file. Pipe commands such as Get-Process into it to create a shareable snapshot with column headings and substantially more detail than the default screen display. section 6.2.1
Use Export-CSV with these practical rules:
- Read exported data with Import-CSV rather than Get-Content when you want PowerShell to interpret the fields and recreate object-like output. section 6.6
- Choose -Delimiter "|" for pipe-delimited output, -UseCulture for the system's list separator, and -IncludeTypeInformation to add type information. section 6.8 section 6.7
- Use -NoClobber to prevent overwriting an existing file or -Confirm to request approval before writing. section 6.8
Export and reopen process data
Get-Process | Export-CSV procs.CSV Import-CSV procs.CSV The first command saves current process information; the second displays the saved snapshot rather than live process data. section 6.2.1
Get-Process | Export-CSV procs.CSV
Run the command to create a CSV file from current process objects, then inspect or import the resulting file. section 6.2.1
