Active Directory Password Change - Won't search down contexts

RareGamerZ

New Member
I have a legacy script that handles some password resets for our students accounts but it seems to hit a bit of a snag when users are moved to Sub OU's and causes issues.Basically the following is the LDAP connection string.\[code\]strLDAP ="LDAP://Studc01.student.college.ad:389/OU=Students,DC=student,DC=college,DC=ad"\[/code\]If student accounts reside in this main OU, the script seems to be able to reset their password to the default specified. However if accounts are in sub OU's from the top Students OU, the script falls over and fails out.The script is as follows and takes some info from previously input text fields.\[code\]if request.form("AccountName")<> "" thensAMAccountName = request.form("AccountName")cUser = request.form("User")elseresponse.write("There was an error no account details were given.")response.endEnd ifstrLDAP ="LDAP://Studc01.student.college.ad:389/OU=Students,DC=student,DC=college,DC=ad"Set obj = GetObject(strLDAP)for each objUser in objif ucase(objUser.sAMAccountName) = ucase(sAMAccountName) thenExit forend ifnextResponse.write("The password has now been reset (Password1) for account " & objUser.sAMAccountName & ", thank you")objUser.SetPassword "Password1"objUser.Put "pwdLastSet", 0objUser.SetInfo\[/code\]The scripts seem to use the network service in application pool within IIS to run - any ideas on why it is unable to search down contexts?
 
Back
Top