How to add a user to a sub domain using VB6?

How to add a user to a sub domain using VB6?

Post by John » Thu, 03 Jul 2003 02:16:25



I am trying to add a user to a sub domain and get 'General
access denied error' at the SetInfo call.  I can add the
user through AD users and groups logged on as the same
user as when I run the VB6 code.  Is it possible to add a
user to the sub domain programmatically?


StrContainer= CN=users,DC=subd,DC=development

  Set oContainer = GetObject("LDAP://" & strContainer)
    ' --- Create the user object ---
    Dim strUserFullname As String

    strUserFullname = strFirstName & " " & strLastName

    Set oUser = oContainer.Create("user", "cn=" &
strUserFullname)

    'strSAMAcctName =   make this up to 20 chars of flash
user name
    oUser.Put "sAMAccountName", Mid(strSAMAcctName, 1, 20)

    oUser.Put "userPrincipalName", strUserPrincpalName

    ' --- Write the object to the directory ---
    ' if this fails the AccountName name is in use

    oUser.SetInfo

 
 
 

How to add a user to a sub domain using VB6?

Post by Jian-Shen Lin[M » Fri, 04 Jul 2003 18:37:00


DO you have enough permission in your sub domain?

For example: you current logon user have permission is the sub domain admin
or domain user?

Thanks

Jian shen

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