Solved

Script to Change User Logon Name for 2000 Users

Posted on 2008-06-17
1
818 Views
Last Modified: 2012-09-10
Hi.

I have 2000 user accounts that I need to change the logon name for.  The new logon names will be supplied in a CSV file.  Does anybody know of a script or a tool that will do this?

Many Thanks
0
Comment
Question by:Zanthras1st
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 31

Accepted Solution

by:
Henrik Johansson earned 500 total points
ID: 21802348
If you only want to change the UPN for the users and the CSV-file is formated as "olduser,newuser", you can use the following cmd-line. The dsquery/dsmod commands are found in adminpak.msi

C:\>for/f "delims=," %a in (filename.csv) do @dsquery user -upn %a|dsmod user -upn %b


If you nead to change SamAccountName, you nead to format a LDIF-file and import it by using the LDIFDE-command.

C:\>ldifde -i -f import.ldf

The import.ldf has the following syntax. Remember to end the file with a single '-' to avoid an error.

CN=user1,OU=ou-path,DC=domain,DC=com
changetype:modify
replace:samaccountname
samaccountname:newSamAccountName1

CN=user2,OU=ou-path,DC=domain,DC=com
changetype:modify
replace:samaccountname
samaccountname:newSamAccountName2
-
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn about cloud computing and its benefits for small business owners.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question