Bit of an old thread, but i'm doing this just now. I'm in the process of updating my AD fields, i use the addusers command line tool which only fills in the display name, not first/last name.
I created a csv with student logon, name and surname in separate columns, then mailmerged it with the following:
dn: CN=<logon>,OU=Year XX Students,OU=School Students,OU=School Users,OU=School Name,OU=Schools,DC=Education
newRdn: CN=<name> <surname>,OU=Year XX Students,OU=School Students,OU=School Users,OU=School Name,OU=Schools,DC=Education
You need to make sure there's one blank line between each record, then use ldifde to import the file. Command line is
ldifde -i -f filename.txt -s server
You can also add -j <path> for logging, -v for verbose and -k for ignoring the 'object does not exist' error.
Bit longwinded but it seems to work.
CSV into powershell is probably the best way these days?
Import-Csv c:\users.csv | ForEach
$Name = $_.givenName + " " + $_.sn
-Name $Name `
-sAMAccountName $_.sAMAccountName `
-GivenName $_.givenName `
-Surname $_.sn `
-Initials $_.initials `
-DisplayName $_.displayName `
-Department $_.department `
-AccountPassword $_.ctPassword `
-Path $_.OU `
-ChangePasswordAtLogon $true `
Import-Csv c:\users.csv | ForEach ($User in $Userscsv)
title =$user.'job title';
company = $User.'business unit';
department = $User.'home department';
telephonenumber = $User.'work phone';
mobile = $User.'work wireless'