Is there a way of quickly population the "First Name and Last Name" fields in Active directory, for example importing from a csv file, or a command line option?
At present, our students only have a username and display name specified, but we wish to add their real names to help staff locate their email address through the Outlook Address book. With nearly 2000 students, we need a better method than simply typing them all in from a list!
HI
This might be just the thing your looking for
Dsmod user
if you've got a csv file with there username, forename and surname this bit of powershell from our script here might help you out
Hope this HelpsCode:function get-dn ([string]$SAMName,[string]$type) { $root = [ADSI]'' $searcher = new-object System.DirectoryServices.DirectorySearcher($root) if($type.Contains("group")){ $searcher.filter = "(&(objectClass=group)(cn= $SAMName))" } else{ $searcher.filter = "(&(objectClass=user)(sAMAccountName= $SAMName))" } $user = $searcher.findall() if ($user.count -gt 1){ $count = 0 foreach($i in $user){ write-host $count ": " $i.path $count = $count + 1 } $selection = Read-Host "Please select item: " return $user[$selection].path.toString() } else{ return $user[0].path } } Import-Csv c:\somefile.csv | ForEach-Object{ $userDN = get-dn $_.username dsmod user $UserDN.substring(7) -fn $_.Forename -ln $_.Surname -display ($_.Forename + " " + $_.Surname) }
.Adam

I use this - http://www.wisesoft.co.uk/software/b...s/default.aspx from Wisesoft, great tool I used it to update loads of fields from MIS Exports this summer just gone in our AD and its another great free tool from them![]()
I wrote a script to do something like this the other week,
mine reads the display name, chops it up and puts it back into the first/last name fields.
It would be simple to modify to read from a file instead.
Code:Set colItems = GetObject _ ("LDAP://OU=pupils,DC=domain,DC=xxx,DC=xx") colitems.filter = Array("user") on error resume next For Each objuser in colItems err.clear ltest = objuser.lastname if err.number <> 0 then wscript.echo "fixing ->" & objuser.displayname namearray = split(objuser.displayname," ") zfirstname = namearray(0) zsurname = namearray(1) objuser.firstname = zfirstname objuser.lastname = zsurname objuser.setinfo wscript.echo "Done: " & objuser.firstname & " " & objuser.lastname end if Next
There are currently 1 users browsing this thread. (0 members and 1 guests)