• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Changing user names in Active Directory

DaveB

Nice But Dim
Joined
Oct 29, 2005
Messages
21,124
Likes received
5,496
Thanks received
1,575
Does anyone know of any tools or methods for automating a change of name for AD accounts?

Due to an integration program with parent co. IT systems we may have to rename all out AD accounts to match the new corporate naming convention.
 
Is there nothing in the Admin tools that fits the bill?

In my techiedays, I always found Petri to be a handy resource for advice.
 
Is there nothing in the Admin tools that fits the bill?

In my techiedays, I always found Petri to be a handy resource for advice.

Sadly not. The standard tools will let you do it on a case by case basis but are not practical for circa 5000 users given the time it would take and the scope for human error in the process.

I'm leaning towards a VB script, something like this:

Code:
set objCont = GetObject("LDAP://" & ParentDN)
objCont.MoveHere "LDAP://cn=" & UserOldName & "," & ParentDN, "cn=" &
UserNewName
set objUser = GetObject("LDAP://cn=" & UserNewName & "," & ParentDN)
objUser.Put "name", UserNewName
objUser.SetInfo

Reading from a spreadsheet of original and target names.
 
Take a look at the admod tool AdMod

admod -b "<DN>" samaccountname::<new username> userprincipalname::<UPN> givenname::<forename> sn::<surname>

Ian
 
Sadly not. The standard tools will let you do it on a case by case basis but are not practical for circa 5000 users given the time it would take and the scope for human error in the process.

I'm leaning towards a VB script, something like this:

DaveB

If you would like to sling me a script to create a few thousand users, I would be more than happy to do some testing on your behalf. No, I don't want real usernames; just something to test my newfound Windows Server and AD skills on.

As an addendum, if you wish to change attributes in AD, have a look at AttributeChanger (scroll down past the German to the example to see what it can do).

If you have trouble registering for the download on account of it all being in German, drop me a PM and I will assist.
 
Last edited: 15:37
Does anyone know of any tools or methods for automating a change of name for AD accounts?

Due to an integration program with parent co. IT systems we may have to rename all out AD accounts to match the new corporate naming convention.

You can leverage the ADSI API with prett ymuch any scripting language, VBscript, Powershell will have loads of scripts all over the internet. other languages can be used

Or use the inbuilt tools available on a Domain Controller such as dsmod
 

Advertisers

Back
Top