Change Active Directory CN without recreating account

To change an Active Directory CN without recreating the account for one user account; In "Active Directory Users and Computers" we can Right click on the user in AD and select "Rename" we will be prompted for all appropriate fields to rename.

this methode is good if I want to change one user account but we need to change several account (1000) for that please I need a script (powershell or Vbs) to change the CN attribute for a list of users accounts (.csv) from lowercase (user01) to uppercase (USER01).

For example,
Change the CN of this sAMAccountName
Csv file:

Best regards,
Who is Participating?
footechConnect With a Mentor Commented:
You can use this.
Import-Csv file.csv | ForEach `
    Get-ADUser $_.samAccountName |
     Rename-ADObject -NewName "$(($"

Open in new window

It assumes headers of "samaccountname" and "cn" in the .CSV.  If you're using a delimiter other than a comma, you can specify it with the -Delimiter parameter of Import-CSV.
DRRAMAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.