Re: AD user rename
- From: "Richard Mueller [MVP]" <rlmueller-NOSPAM@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 18 May 2005 18:29:38 -0500
Toma¾ Kralj wrote:
> Hi,
>
> I found way to change cn and name.
>
>
> I added following code:
>
> vmoj=usr.get("name")
> Set newobj = oTargetOU.MoveHere("LDAP://cn=" & vmoj & ","& strTargetOU
> ,"cn=" & vFullname)
>
>
> It works. At the same time cn and name is changed.
>
> Just when script is done I get error:
> C:\chgupn-4.vbs(40, 7) (null): There is no such object on the server.
Hi,
Name is actually a property method that returns the Relative Distinguished
Name (RDN) of the object. For user objects, this is the "cn" (Common Name)
attribute, with "cn=" appended. Thus, it returns the first part of the
distinguishedName.
I believe your vmoj variable will be in the form "cn=jsmith", so "cn=" is
repeated. Try:
Set newobj = oTargetOU.MoveHere("LDAP://" & vmoj & "," & strTargetOU, "cn="
& vFullName)
Or, you can use the distinguishedName attribute of the user object. For
example:
Set newobj = oTargetOU.MoveHere("LDAP://" & usr.distinguishedName, "cn=" &
vFullName)
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab web site - http://www.rlmueller.net
--
.
- Follow-Ups:
- Re: AD user rename
- From: Sean M. Loftus
- Re: AD user rename
- References:
- AD user rename
- From: Tomaž Kralj
- AD user rename
- Prev by Date: RE: adding password to ODBC
- Next by Date: Re: vbscript logon script getting return data from sql sp
- Previous by thread: AD user rename
- Next by thread: Re: AD user rename
- Index(es):
Relevant Pages
|