vb.net - Adding Active Directory sub domain user to main domain group -
i have function works when attempt add user same domain group of same domain.
function addusertogroup(byval struserdn string, byval strgroupdn string, byval strgrpdc string, byval struserdc string) boolean     dim ouser directoryentry     dim ogroup directoryentry     dim blnstatus boolean     try         ouser = new directoryentry("ldap://" & struserdn)         ogroup = new directoryentry("ldap://" & strgroupdn)         ogroup.invoke("add", ouser.path.tostring)         ogroup.commitchanges()         blnstatus = true     catch ex exception                 //catch error...send email support     end try     ouser = nothing     ogroup = nothing     return blnstatus end function   what need able add user sub domain main domain group. example:
main domain: geo.com sub domain: customer.geo.com
i have user: homer simpson member of customer.geo.com domain. want add user group in geo.com domain. passing correct full adspath non helpful error message:
user: wacustdc2/cn=simpson\, homer,ou=geo test ou,ou=customers,dc=customer,dc=geo,dc=com group: wadc4/cn=qsgeotestou_rw,ou=permission groups,ou=resources,dc=geo,dc=com error: exception has been thrown target of invocation.   the error being thrown on invoke line, said earlier, if user in same domain, works perfectly.
any thoughts or suggestions appreciated.
geo...
you're relying on iadsgroup.add method. correct syntax (i think - i'm c# user):
ogroup.invoke("add", new object[] { ouser.path }   you need check if it's member of group because you'll error if is.
Comments
Post a Comment