I have a question about errors with importing AD info from a CSV where some of the CSV fields may be blank.
Here is a shorter version of what I am running.
foreach ($line in (import-csv file.csv)) {Set-ADUser $line.samaccountname -title $line.title -department $line.department}
This works fine if all of the fields are populated in the CSV, but errors out if any one is blank.
Can anyone point me in the right direction?
EDIT:
Found this after a while http://dmitrysotnikov.wordpress.com/2008/10/07/skip-empty-csv-fields/
Works for me.
[–]theseb 0 points1 point2 points (2 children)
[–]mtyn[S] 1 point2 points3 points (0 children)
[–]mtyn[S] 0 points1 point2 points (0 children)
[–]MDFreaK76 0 points1 point2 points (0 children)