Solved

Script to Change User Logon Name for 2000 Users

Posted on 2008-06-17
1
799 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
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
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.

860 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