Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27511

Active Directory Groups vb.net

$
0
0
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


Code:

    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


Code:

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

Viewing all articles
Browse latest Browse all 27511

Trending Articles