Solved

Script to Change User Logon Name for 2000 Users

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
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.

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now