Getting LDAP DistingushedName for user and Group?
- From: jc <wildman@xxxxxxxxxxxx>
- Date: Mon, 19 May 2008 07:15:07 -0700 (PDT)
I'm having some trouble getting this code to work. I'm trying to place
an existing AD user into an existing AD group.
Private Sub AddUserToGroup(ByVal GroupDN As String, ByVal UserDN As
String)
'GroupDN should be the full DistinguishedName of the Group
'UserDN should be the full DistinguishedName of the User (Do
not include the LDAP:// part)
Dim Group As New DirectoryEntry("LDAP://" & GroupDN)
Try
Group.Properties("member").Add(UserDN)
Group.CommitChanges()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
If my server name is D1 and the domain is D2.D3 and the group is JCP
and the user is Johndoe.. should it the user and group be as follows
group:
"LDAP://CN=JCP,OU=D1,DC=D2,DC=D3"
user:
"CN=johndoe,OU=D1,DC=D2,DC=D3"
Isn't the OU the computer name?
Thanks for any help or information.
.
- Follow-Ups:
- Re: Getting LDAP DistingushedName for user and Group?
- From: Joe Kaplan
- Re: Getting LDAP DistingushedName for user and Group?
- Prev by Date: Re: Password encryption
- Next by Date: Re: Csharp code to add an AD user to an AD group?
- Previous by thread: Password encryption
- Next by thread: Re: Getting LDAP DistingushedName for user and Group?
- Index(es):
Loading