Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Active Directory
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , ,

Sponsored Links



Bulk rename of user accounts in Active Directory

Active Directory


Reply
 
Thread Tools Search this Thread
  #1  
Old 06-03-2005
Amihai Bareket
 
Posts: n/a
Bulk rename of user accounts in Active Directory

Due to a change to the naming policy, I need to rename around 1000 user
accounts in active directory (Windows Server 2003, Native Mode)
The user name (Name & CN) should be like the samAccountName attribute.

I've tried to do it with LDIFDE but I got an error message that I can't
rename the user account because "The attribute is owned by the system".

I can live with a text file that has all the user details (CSV?) because
this is a one time job and I rather be safe then sorry and I think I'd
rather not let the script run fully automatically.

Any ideas on how to do a bulk rename of user account in active directory
through batch/script?


Reply With Quote
  #2  
Old 06-03-2005
Bill Nitz
 
Posts: n/a
Re: Bulk rename of user accounts in Active Directory

Amihai,
You can use a variety of methods, but keep in mind that changing the CN
is effectively a move, not an attribute change. So if you need to
change a user CN, you need to 'move' that object, even if it's staying
in the same container.

In VBscript, this would be done through something like this:
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

Bill

Reply With Quote
  #3  
Old 07-03-2005
Joe Richards [MVP]
 
Posts: n/a
Re: Bulk rename of user accounts in Active Directory

The change type for LDIF for a CN change (assuming the CN is the RDN attribute
which in the case of users it is...) is changetype:modrdn. This is because it is
an object rename, not a normal attribute change.

If using ADSI scripting, they consider it a move so you use the method movehere.

If using LDAP API you want to use ldap_rename_ext.

joe


--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net


Amihai Bareket wrote:
> Due to a change to the naming policy, I need to rename around 1000 user
> accounts in active directory (Windows Server 2003, Native Mode)
> The user name (Name & CN) should be like the samAccountName attribute.
>
> I've tried to do it with LDIFDE but I got an error message that I can't
> rename the user account because "The attribute is owned by the system".
>
> I can live with a text file that has all the user details (CSV?) because
> this is a one time job and I rather be safe then sorry and I think I'd
> rather not let the script run fully automatically.
>
> Any ideas on how to do a bulk rename of user account in active directory
> through batch/script?
>
>

Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Active Directory


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Bulk rename of user accounts in Active Directory"
Thread Thread Starter Forum Replies Last Post
Bulk NT user rename how? chandra GP Operating Systems 2 08-09-2008 01:02 PM
MS Access bulk update Active Directory Starke Active Directory 3 13-07-2008 12:16 AM
Delegate Control in Active Directory to allow group to unlock user accounts Nino_1 Active Directory 4 02-11-2007 01:35 AM
Rename active directory user PolarBear Active Directory 3 19-09-2007 06:35 PM
How to get a listing of expired Active Directory user accounts ? Tom_Small Windows Server Help 4 17-05-2007 10:29 PM


All times are GMT +5.5. The time now is 12:37 PM.