Is it possible to reference an object property by variable?
So my script reaches out to AD and obtains all possible properties for user accounts. It then attempts to iterate through every single USER object and obtain every single property value whether it has been set or not.
Each part of this works. However, when I try to bring it all together I am running into an issue I did not expect, but should have.
The value of arrAttribs(0) = "cn".
When I set a str variable (Verifier) to equal objUser.cn there is no problem and it works perfectly.
When I set a str variable to equal objUser.arrAttribs(0) i get the error: Object doesnt support this property or method.
What I am trying to figure out how to do is to successfully set variables to objUser.[variable]
Do Until objRecordSet.EOF
strDN = objRecordSet.Fields("distinguishedName")
Set objUser = GetObject("LDAP://" & strDN)
For i = LBound(arrAttribs) To UBound(arrAttribs) Step 1
Verifier = objUser.cn
Data = objUser.arrAttribs(i)
Next i
objRecordSet.MoveNext
Loop
Recent comments
5 years 41 weeks ago
6 years 27 weeks ago
6 years 39 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 48 weeks ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago