Getting LDAP DistingushedName for user and Group?



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.
.


Loading