PowerShell Genie

Export-Csv

Use Export-Csv to convert objects into CSV-formatted data and write it to a file. See Microsoft.PowerShell.Utility module requirements and examples.

Command 1 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — export-csv

Syntax

1PS> Export-Csv [[-Path] <string>] [-Delimiter <Char>] [-NoTypeInformation] [-Append] [-Force] [-Encoding <Encoding>] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Export-Csv [[-Path] <string>] [-Delimiter <Char>] [-NoTypeInformation] [-Append] [-Force] [-Encoding <Encoding>] [<CommonParameters>]
  1. Stage 1Export-Csv-Path -Delimiter -NoTypeInformation -Append -Force -Encoding

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    Get-Service -NoTypeInformation

    1PS> Get-Service | Export-Csv C:\Reports\services.csv -NoTypeInformation
    Show reference output

    Illustrative output · values vary by environment

    (No pipeline output. The selected objects were written to the CSV file.)

    Get-ADUser -Filter *

    1PS> Get-ADUser -Filter * | Select-Object SamAccountName,Name,Enabled | Export-Csv C:\Reports\users.csv -NoTypeInformation
    Show reference output

    Illustrative output · values vary by environment

    (No pipeline output. The selected objects were written to the CSV file.)

    Parameters

    Parameter definitions:

    • -Path
    • -Delimiter
    • -NoTypeInformation
    • -Append
    • -Force
    • -Encoding

    Microsoft Learn — export-csv

    Export objects rather than formatted text

    Export-Csv writes object properties as columns. Select the desired properties before exporting. Sending Format-Table output to it exports formatting records instead of your original data.

    Choose the file contract

    Set a delimiter and encoding appropriate to the reader. Encoding defaults differ between Windows PowerShell and newer PowerShell releases, so specify one when exchanging files between systems. -NoTypeInformation keeps a Windows PowerShell export free of its type-information line.

    Appending needs a stable schema

    Keep the same property names when appending rows. Review mismatched columns rather than using -Force to hide the problem. Ensure the parent folder exists and that your account can write to it.

    Reopen a test export with Import-Csv and compare its column names and row count. Imported values usually require conversion when later calculations need numbers or dates.

    Choose CSV columns · Read back a CSV file

    Updated 1 October 2026. Browser outputs are fictional; check the installed module help for your environment.

    Put this command to work

    Write your first report

    Save Name and Status for all services to C:\Lab\report.csv without type information.

    Review the lesson

    Recap

    Export-Csv Use Export-Csv to convert objects into CSV-formatted data and write it to a file. See Microsoft.PowerShell.Utility module requirements and examples.

    Next: ConvertFrom-Json
    Genie guideExport-Csv

    Use Export-Csv to convert objects into CSV-formatted data and write it to a file. The console below is pre-loaded — run it, then change a value and run it again.