making AD Group a member of another group?

Swain90

New member
Joined
Dec 12, 2013
Messages
4
Programming Experience
Beginner
Hi All,

I have a small issue of making a Active Directory Group a member of another group.

I have been able to create a group, I have been able to make a user a member of that group, but when I try and make a group a member of another group e.g. TestGroup a member of Administrators I'm currently get an error of "The server is unwilling to process the request"

As far as I was aware Users and Groups are both containers so I'm not sure why when adding a user to a group it works, but when trying to make a group a member of another group it doesn't work.


Adding a User to a group WORKING

VB.NET:
     Try
            Dim group As New DirectoryEntry("LDAP://cn=TestGroup, ou=Test, dc=TEST, dc=com")
            group.Properties("member").Add("cn=TestUser, ou=Test, dc=TEST, dc=com")
            group.CommitChanges()
            Return True
        Catch ex As Exception
            MsgBox(ex.Message)
            Return False
        End Try

Trying to add a TestGroup2 to the group TestGroup which are in the same Organisational Unit NOT WORKING
VB.NET:
 Try
            Dim group As New DirectoryEntry("LDAP://cn=TestGroup, ou=Test, dc=TEST, dc=com")
            group.Properties("member").Add("cn=TestGroup2, ou=Test, dc=TEST, dc=com")
            group.CommitChanges()
            Return True
        Catch ex As Exception
            MsgBox(ex.Message)
            Return False
        End Try


Any help on this would be great, tried alot of googling and msdn but no luck


Thanks

Swain90
 
Resolved

This is currently Working



VB.NET:
Private Function GroupMemberOf() As Boolean
  Try
            Dim group As New DirectoryEntry("LDAP://cn=Remote Desktop Users, cn=Builtin, dc=Test, dc=net")
            group.Properties("member").Add("cn=[COLOR=#3E3E3E]TestGroup2, ou=Test, dc=TEST, dc=net")[/COLOR]
            group.CommitChanges()
            Return True
        Catch ex As Exception
            MsgBox(ex.Message)
            Return False
        End Try
End Function



VB.NET:
 Private Sub BtnGroupOf_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGroupOf.Click        
GroupMemberOf()
    End Sub
 

Latest posts

Back
Top