Solved

Script to Change User Logon Name for 2000 Users

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

20 Experts available now in Live!

Get 1:1 Help Now