Pcornel
Automation · PowerShell Automation

CSV

Cheat sheet · https://pcornel.dk/topic.php?topic=5253

Back to the Topic

Answer

PowerShell handles CSV with Import-Csv, which turns rows into objects with properties from the header, and Export-Csv -NoTypeInformation for reports.

Remember

  • Import-Csv returns objects with header names as properties.
  • Export-Csv -NoTypeInformation writes clean files.
  • Set -Delimiter and -Encoding explicitly.

First checks

  • Import-Csv f.csv -Delimiter ';' — import
  • Export-Csv out.csv -NoTypeInformation -Encoding utf8 — export
  • Required columns validation — input checks

Verify in this order

CSV → Import-Csv → objects → validation

Where it usually breaks

Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.

CSV · PowerShell operational reference

BoundaryCSV reference
Runtime identityPowerShell edition/version + command/module source
Persistent intentScript/module/config prerequisites under source control
VerificationRead-only discovery → execution evidence → independent target read-back
Output contractStructured objects/streams before formatting
Failure boundarySeparate engine/binding from transport/API/native and target-state failures

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5253

Confirmation

Confirm action

Continue?