Mass Data Addition for Existing eDirectory Users

0 Likes

Problem



A Forum reader recently asked:



"I need to import employeeID and company information from a csv file into eDirectory. I know you are supposed to be able to do this with ICE but most of what I'm finding in the TIDs tells me how to bulk import users, not change or add data for existing users."



And here's the response from eDirectory expert Jim Henderson ...



Solution



If you perform an export from ICE just with CN entry names for user objects, you can run this through the linux AWK command with a bit of work to create an import file. I use awk in this way an awful lot.



For example, if I had a CSV file in the format:



userid,employeeid


then I'd do this:



awk 'BEGIN {FS=","; print "version: 1\n"} {print "dn: cn=" $1
",ou=orgunit,o=org\nchangetype: modify\nmodify: employeeID\nemployeeID: "
$2 "\n"}' < file.csv > file.ldif



This assumes that you have an attribute definition for employeeID associated with the user class. If you're using aux classes, then it's a little more involved because you need to add a value to the objectClass attribute for your aux class first.



This also assumes that all objects are in the same container. Changing the script to account for multiple containers is not very difficult to do, though.

Labels:

How To-Best Practice
Comment List
Related
Recommended