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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DRRAMAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.