locked
AD First and Last name modifying RRS feed

  • Question

  • Hi,

    When checking my AD environment, I found most of the users first and last name is missing when created.The user accounts have Display Name and Email ID. How can I quickly fill the first and last names for these users.


    Regards,

    Kalyan


    • Edited by Ajay bb Monday, September 12, 2016 9:02 PM
    Sunday, September 11, 2016 11:28 AM

Answers

  • OK, so if you can generate a CSV file somehow that has the following format

    Username,Firstname,Lastname
    jdoe,John,Doe
    mlou,Mary,Lou
    etc...

    you can do

    $users = Import-CSV C:\temp\users.csv 
    foreach ($user in $users) {
        try {
            $aduser = Get-ADUser ($user.Username)
            $aduser | Set-ADUser -Surname $user.Lastname -GivenName $user.Firstname -Confirm:$false
        } catch {
            Write-Host "User $($user.Username) not found"
        }
    }


    Evgenij Smirnov

    msg services ag, Berlin -> http://www.msg-services.de
    my personal blog (mostly German) -> http://it-pro-berlin.de
    Windows Server User Group, Berlin -> http://www.winsvr-berlin.de
    Mark Minasi Technical Forum, reloaded -> http://newforum.minasi.com

    In theory, there is no difference between theory and practice. In practice, there is.

    • Marked as answer by Ajay bb Friday, September 16, 2016 2:09 AM
    Tuesday, September 13, 2016 8:20 AM
  • off-topic for this forum, not related to training and certification.

    Danny

    Wednesday, September 14, 2016 9:17 AM
    Answerer

All replies

  • Where would you be getting this data from? Do you have a list of FirstName, LastName, Username or would you have to extract that information from the DisplayName? The latter is not always reliable because some people have multiple first names and some even have multiple last names ("de Silva", "Pich von Lipinski").

    Evgenij Smirnov

    msg services ag, Berlin -> http://www.msg-services.de
    my personal blog (mostly German) -> http://it-pro-berlin.de
    Windows Server User Group, Berlin -> http://www.winsvr-berlin.de
    Mark Minasi Technical Forum, reloaded -> http://newforum.minasi.com

    In theory, there is no difference between theory and practice. In practice, there is.

    Sunday, September 11, 2016 6:47 PM
  • Hi,

    We do use Manage Engine's AD manager tool to fetch the users without first and last name and exported this data to excel sheet.  I want to use the data to fill first and last names  as we do use firstname.lastname for our Email address policies

    Regards,

    Kalyan

    • Edited by Ajay bb Monday, September 12, 2016 9:02 PM
    Monday, September 12, 2016 8:56 PM
  • OK, so if you can generate a CSV file somehow that has the following format

    Username,Firstname,Lastname
    jdoe,John,Doe
    mlou,Mary,Lou
    etc...

    you can do

    $users = Import-CSV C:\temp\users.csv 
    foreach ($user in $users) {
        try {
            $aduser = Get-ADUser ($user.Username)
            $aduser | Set-ADUser -Surname $user.Lastname -GivenName $user.Firstname -Confirm:$false
        } catch {
            Write-Host "User $($user.Username) not found"
        }
    }


    Evgenij Smirnov

    msg services ag, Berlin -> http://www.msg-services.de
    my personal blog (mostly German) -> http://it-pro-berlin.de
    Windows Server User Group, Berlin -> http://www.winsvr-berlin.de
    Mark Minasi Technical Forum, reloaded -> http://newforum.minasi.com

    In theory, there is no difference between theory and practice. In practice, there is.

    • Marked as answer by Ajay bb Friday, September 16, 2016 2:09 AM
    Tuesday, September 13, 2016 8:20 AM
  • off-topic for this forum, not related to training and certification.

    Danny

    Wednesday, September 14, 2016 9:17 AM
    Answerer
  • Hi,

    Thanks a lot this has worked for me

    Regards,

    Kalyan


    Regards, Narasimha Rao

    Friday, September 16, 2016 2:09 AM