Announcement

Collapse
No announcement yet.

ADUC CN (fullname) change

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ADUC CN (fullname) change

    We have a Win2k3 domain that was migrated from Windows NT 4.0 domain.
    All accounts created in the NT4.0 domain are listed in ADUC as
    FIRSTNAME LASTNAME
    Our naming convention uses LASTNAME, FIRSTNAME

    I found this script on this site, and was hoping it would work, but I am getting an error on line 8, char 101 - Expecting end of statement.

    ---------------------------------------------------------

    Set objConnection = CreateObject("ADODB.Connection")
    objConnection.Open "Provider=ADsDSOObject;"
    Set objCommand = CreateObject("ADODB.Command")
    objCommand.ActiveConnection = objConnection
    objCommand.CommandText = _
    "<LDAP://ou=users, OU=mylab, OU=myOU, DC=mydomain, DC=com>;(&(objectCategory=User)" & _
    "(displayname=*));ADsPath;Subtree"
    Set objRecordSet = objCommand.Execute
    Do Until objRecordset.EOF
    strADsPath = objRecordset.Fields("ADsPath")
    Set objUser = GetObject(strADsPath)
    vcn = objUser.get ("cn")
    vFullName = objUser.get ("displayName")
    vlDAPPath = "cn=" & vcn & ",OU=Users, OU=mylab, OU=myOU, DC=mydomain, DC=com"
    REM objUser.Put "cn", vFullName
    objUser.SetInfo
    set cont = GetObject("ldap://OU=Users, OU=mylab, OU=myOU, DC=mydomain, DC=com")
    set usr = cont.MoveHere("LDAP://" & vlDAPPath, "cn=" & vFullName)
    objRecordSet.MoveNext

    Loop
    objConnection.Close

    -----------------------------------

    I am a total newbie at this. I can read these, but am unable to write the code myself.

    Thanks

  • #2
    Re: ADUC CN (fullname) change

    Hi Steve,

    That script was posted on 11th April 2005 by topper, http://forums.petri.com/showthread.php?p=9418#post9418

    Some scripts posted before August 12 2005 might possibly be corrupted, due to a forum migration we had on that date. This caused a replacement of two particular signs to their HTML-code substitute.

    To Fix this:
    Copy and paste the code to your script editor.
    then,
    - Find & Replace & with &
    - Find & Replace &lt; with <


    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Still not working

      Thanks, I removed the extra data in the script.
      I'm having an issue with

      Error:There is a naming violation.
      Code:80072037

      My problem is we had an old NT4 domain, which was converted to 2003.
      The NT4 accounts are displayed in ADUC as (FirstName LastName)
      All New accounts are created as (LastName, FirstName)
      When new (2003) account are created, the LDAP info gets an extra "\" inserted.

      I want to change the DN info from
      (cn=<sn>\,<givenName>,ou=myou,ou=mywrkgrp,dc=mydom ain,dc=com")
      to
      (cn=<sn>,<givenName>,ou=myou,ou=mywrkgrp,dc=mydoma in,dc=com")

      Thanks
      Last edited by SteveFaris; 17th December 2008, 22:46. Reason: save caused type-O- in dc=mydomain

      Comment

      Working...
      X