I decided that it was a pita to change the script for every domain, so googling aroud I found that almost everywhere the scripts finds the information itself. This part was easy to get working, however, it no longer pulls out all the values I need.
Current functioning code
Current non-functioning code
I can't get this output, like I could before
The error:
I understand that it cannot do this due to not having pulled out all the values like before, but I cannot figure out how to pull these values out with the new query.
Any ideas?
Current functioning code
Code:
objCommand.CommandText = _
"SELECT Name, sAMAccountName, mail, proxyAddresses, homeDirectory, homeDrive, memberOf, scriptPath, ObjectClass, UserAccountControl FROM 'LDAP://dc=AdvizorIT,dc=local' WHERE objectCategory='Person'"
Set objRecordSet = objCommand.Execute
Current non-functioning code
Code:
Set rootDSE = GetObject("LDAP://RootDSE")
DomainContainer = RootDSE.Get("defaultNamingContext")
ldapStr = "<LDAP://" & DomainContainer & ">;(objectCategory=person);adspath;subtree"
Set objRecordSet = conn.Execute(ldapStr)
I can't get this output, like I could before
Code:
Wscript.Echo objRecordSet.Fields("Name").Value
The error:
Code:
Item Cannot be found in the collection corresponding to the requested name or ordinal
I understand that it cannot do this due to not having pulled out all the values like before, but I cannot figure out how to pull these values out with the new query.
Any ideas?