objConnection = CreateObject("ADODB.Connection") objConnection.Open("Provider=ADSDSOObject") cSQL = "SELECT distinguishedName FROM 'LDAP://dc=hhccas,dc=local' WHERE objectCategory='user' and employeeID = '12345'" objRecordSet = objConnection.Execute(cSQL) IF objRecordset.RecordCount > 0 objRecordSet.MoveFirst() cTmpOU = objRecordSet.Fields("distinguishedName").Value objOU = GetObject("LDAP://"+SUBSTR(objRecordSet.Fields("distinguishedName").Value, ; AT(",OU",UPPER(objRecordSet.Fields("distinguishedName").Value))+1, ; LEN(objRecordSet.Fields("distinguishedName").Value))) * In the actual code, I have some wait windows that tell me I am making it to the line below: ********************************************************************* objOU.MoveHere("LDAP://"+SUBSTR(cTmpOU,1,AT(",OU",UPPER(cTmpOU))-1)+ ; ",OU=Students,OU=Disabled,dc=hhccas,dc=local", null ) ********************************************************************* * Right now I have 'null' where the vb script uses vbNullString. I've tried "0", "", etc but no luck ELSE WAIT WINDOW "No users are in this AD with the employeeID of 12345" ENDIFThe code above works fine to the end if I comment out the highlighted (with asterisks) line above.
Set objOU = GetObject("LDAP://ou=sales,dc=na,dc=fabrikam,dc=com") objOU.MoveHere "LDAP://cn=BarrAdam,OU=hr,dc=na,dc=fabrikam,dc=com", vbNullStringThanks!
>NULL
>
>