I am attempting to add basic ActiveDirectory integration into a Visual Basic 6 (VB6) desktop application. I have found a number of methods to obtaining information from ActiveDirectory, however none have been able to successfully answer the simple question; "Is 'currentuser' a member of 'desiredgroup'?" Some of the solutions I have found so far have come close, allowing me to iterate through the ActiveDirectory objects, however this approach does not resolve multi-tier membership, e.g. User1 is a member of MyGroup which is a member of SuperGroup which is a member of DesiredGroup.
The closest I have come is with something akin to the following, using the ADO OLE DB connector and LDAP_MATCHING_RULE_IN_CHAI
N, but I can't figure out the correct filter syntax to state I want any record for User1 where DesiredGroup is somewhere in the membership tree:
cmdRead.CommandText = "<LDAP://LocalHost>;(membe
rOf:1.2.84
0.113556.1
.4.1941:=C
N=User1);A
DsPath, cn; base"
--or maybe--
cmdRead.CommandText = "<WinNT://MyComputer>;(mem
berOf:1.2.
840.113556
.1.4.1941:
=CN=Desire
dGroup);AD
sPath, cn; base"
Alternatively, the other solution path I have been working with is using the interfaces provided via ActiveDS.dll to connect with GetObject("WinNT://" & strComputer & "") and parse through the objects.
If anyone has some tips or helper routines that can help me get past this learning curve and achieve the function I am working toward with either of these solution trees, or some other that I have not come across yet, it would be much appreciated.
Start Free Trial