update the Existing all AD users firstname, last name and email address with a csv

Abdul Basith 136 Reputation points
2021-08-04T10:22:30.613+00:00

Hi,

I need to update the Existing all AD users firstname, last name and email address with a csv.. and i need the csv format for above task..

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,968 questions
0 comments No comments
{count} votes

Accepted answer
  1. Abdul Basith 136 Reputation points
    2021-08-04T11:58:56.997+00:00

    I figured out the script

    $users = Import-Csv -Path c:\scripts\users.csv

    foreach ($user in $users) {

    Get-ADUser -Filter "SamAccountName -eq '$($user.samaccountname)'" -Properties * |

    Set-ADUser -givenName $user.givenName -displayname $user.displayname -Surname $User.sn -Email $user.mail

    }

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful