Solved

Script to Change User Logon Name for 2000 Users

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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 …
Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
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.

810 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