I have a .csv file (delimiter is |) that has AD fields as the header and the strings to go in there as the data. I'd like to create a hash table from that .csv file that has the column header as the key and the string information as the data.
Here is the file format:
LastName|FirstName|Office|Employeeid|BusinessTitle|CoreSector|Sector|CmbCorePractice|CmbPractice|Region|Committees|SectorLeaderRole|PracticeLeaderRole|AreaCountryRole|FirmLeaderShipRoleOne|FirmLeaderShipRole|generationQualifier|givenName|middlename|sn|extensionAttribute12|homePostalAddress|telephoneNumber|ipPhone|facsimileTelephoneNumber|mobile|homePhone|department|manager|assistant|extensionAttribute13
SMITH|JAMES|AMSTERDAM|0000000000|Leader|Healthcare|#|#|#|Europe|#|#|#|#|#|#|MR|JAMES|#|SMITH|#|#|+1 212 000 7692|0000|#|#|#|Knowledge Management|0001000000|#|#|#|#
The data begins with SMITH and that lines up with LastName.
$ad = import-csv -path myfile.csv -delimiter "|"Set-ADUser -Replace $htrequires a hashtable of attributes and values. Having it in a hashtable vs. object doesn't make any difference as you still need to check attributes one by one against the AD-object and add changed to a "attributestomodify"-hashtable. If the file may contain multiple users, then it's even more reason to useImport-CSV -Delimiter '|'. :-)