I am trying to enumerate the users (and some key information) from an Active directory that has 3000+ users. The biggest limitation is that it must run as a regular domain user (not a domain admin). I have tried 4 difference approaches:
approach 1) This only gives me for the local users ( no domain user ... so I assume it must be run as a domain admin??)
Set objComputer = GetObject("WinNT://" & strDomain)
objComputer.Filter = Array("User")
For Each objUser In objComputer
approach 2) This seems to work but is very very slow
lRet = NetUserEnum(bytServerName(0), 10, FILTER_NORMAL_ACCOUNT, lptrStrBuffer, 1, lUsersRead, lTotalUsers, lHnd)
approach 3) This seems to work very fast but I do not get users. Just what looks like a lot of DNS entrys with objectClass as null (so I assume my syntax is wrong?)
Set conn = New ADODB.Connection
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"
Set rs = conn.Execute("<LDAP://SERV001>;(objectClass=*);ADsPath,objectClass,cn;subtree")
approach 4) This seems fast but I only get info for 1 user at a time. And I have to know what the user is (no good since I am trying to get a list of all users)
usr = GetUserNetworkInfo(bServername(), bUsername())
I will be needing to sync this to another application every 15 minutes so I need a very efficient method (this as part of a VB6 Activex.Dll project)