Pcornel
Automation · Active Directory Automation

CSV-driven Provisioning

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

Back to the Topic

Answer

CSV-driven provisioning reads user or group details from a CSV with Import-Csv and creates or updates AD objects per row, validating each field and reporting rows that failed.

Remember

  • Validate every row before creating anything.
  • Use Import-Csv with the right delimiter and encoding.
  • Report failed rows by line.

First checks

  • Import-Csv users.csv | Test-Csv (custom validation) — input checks
  • Import-Csv users.csv | % { New-ADUser … -WhatIf } — preview
  • Duplicate/conflict checks — uniqueness

Commands

Import-Csv <path> | Measure-Object
Read-only/validation observation for whether CSV parses and how many records are present without provisioning objects.

Verify in this order

CSV → validate → create/update → report per row

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

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

Confirmation

Confirm action

Continue?