Stuck with VB.Net & ActiveDirectory Groups
Im working in VB.Net ( 2.0 framework ) and Im creating an executable app that reads from a MySql database and updates our Active Directory LDAP database as needed Everything works except for adding a user to an AD group.
I know that I have to add the user to the group record (member) and NOT the group to the user record (MemberOf)
' ActiveGroup is predefined and is the samaccountname for the group
ADquery3 = "<LDAP://" & GlobalVar.strldapConnection & GlobalVar.strldapDomain & ">" & _
";(&(objectClass=*)(samaccountname=" & ActiveGroup & "))" & _
";ADsPath;SubTree"
ADcommand3.CommandText = ADquery3
ADrecordset3 = ADcommand3.Execute
Dim objUser3 As Object
objUser3 = GetObject(ADrecordset3.Fields("ADsPath").Value)
' ActiveUser is predefined and is the distinguished name of the user
objUser3.PutEX("member", LTrim(RTrim(CStr(ActiveUser))))
Error:
Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
Am I going about this all wrong?

