VBScript LDAP query into Array -
I need to send a query to LDAP as a wildcard. I have the following code:
Setting SearchLDAP (strUsrName) const ADS_SCOPE_SUBTREE = 2 set objConnection = CreateObject ("ADODB.Connection") set objCommand = CreateObject ("ADODB.Command") objConnection.Provider = "ADOOdubject" objConnection.Open "Active Directory Provider" ObjCommand.ActiveConnection = objConnection objCommand.Properties ("Page Size") = 1000 OBC Commands. Properties ("SearchScope") = ADS_SCOPE_SUBTREE objCommand.CommandText = _ "SEND SEN FROM" LDAP: // DC = SYSTEL, DC = Local 'WHERE' _ & amp; "ObjectCategory = 'User and CN =' & amp; StrUsrName & amp; "* '" set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do objRecordSet.EOF' Wscript.Echo objRecordSet.Fields ("cn") value dim strReturnUser:. StrReturnUser = objRecordSet.Fields ("cn"). Price objRecordSet.MoveNext Loop SearchLDAP = strReturnUser termination function
Together messagebox If I run the MsgBox SearchLDAP ('A'), it will display the last login only if I line "Wscript.Echo objRecordSet. Fields ("cn") assumes, "value" will output all the entries to console it.
What I need to do is return all to the values displayed in a message box such as "user1; user2; user3;" Etc. ... not a separate message box, but all the entries in one output
I just need to do this by running the "msgbox SearchLDAP" ("A") function, in the function "msgbox" being a. What do you mean
I can do it to find out whether it should be in an array and if so, how to get entries into 1 array that I can output.
Thanks in Advnace!
You've almost got it. Move the strReturnUser variable outside the do loop and just retain the string.
dim strReturnUser strReturnUser = "" (cn ") objRecordSet.EOF 'Wscript.Echo objRecordSet.Fields up to" value strReturnUser = strReturnUser & amp; ObjRecordSet.Fields ("cn"). Price & amp; ";" ObjRecordSet.MoveNext Loop SearchLDAP = strReturnUser
Comments
Post a Comment