Ok how would I trouble shoot this.. what command can I use to see the variable.. msgbox(strOU) ? what is the syntax for a message box.. Percy
On Mon, Aug 23, 2010 at 11:07 AM, Joshua Halls <[email protected]> wrote: > Nod, if you look at ADSIEdit you should be able to get the full string on > the user so you can make sure you are doing that part properly. > > --Josh > > On Mon, Aug 23, 2010 at 10:51 AM, McKay, Curtis <[email protected]>wrote: > >> You have the order wrong then. It’s top down from right to left. >> Example: >> >> OU=2014,OU=Students,OU=SCHOOL Users,DC=DISTRICT,DC=local >> >> >> >> Students in this example are in the 2014 OU >> >> >> >> Curtis McKay >> >> Network Administrator >> >> Belleville Township High School District 201 >> >> [email protected] >> >> >> >> *From:* [email protected] [mailto: >> [email protected]] *On Behalf Of *Bill Purcell >> *Sent:* Monday, August 23, 2010 10:40 AM >> >> *To:* Tech-Geeks Mailing List >> *Subject:* Re: [tech-geeks] password reset >> >> >> >> Curtis; >> >> Getting same error.. >> >> can I go that deep with this? >> >> Checked with adsi.. got the ou's right.. but question of right oder.. >> >> you are working from right to left? >> >> users... inside of ou3... inside of ou 2... inside of ou1.. inside of >> dc=name insdide of dc=pvt? >> >> Percy >> >> On Mon, Aug 23, 2010 at 9:45 AM, McKay, Curtis <[email protected]> >> wrote: >> >> Try this: >> >> >> >> strOU = "ou=one, ou=two, ou=three, ou=us, dc=where, dc=pvt " >> >> strUser = InputBox ("Enter User Name") >> strPassword = " p...@550rd1" >> >> On Error Resume Next >> >> Set objConnection = CreateObject("ADODB.Connection") >> >> objConnection.Open "Provider=ADsDSOObject;" >> >> Set objCommand = CreateObject("ADODB.Command") >> >> objCommand.ActiveConnection = objConnection >> >> objCommand.Properties("Page Size") = 3000 >> >> >> >> objCommand.CommandText = _ >> >> "<LDAP://" & strOU & ">;" & _ >> >> >> "(&(objectclass=user)(objectcategory=person)(samAccountName=" & strUser & >> "));" & _ >> >> "adspath,distinguishedname,sAMAccountName;subtree" >> >> Set objRecordSet = objCommand.Execute >> >> >> >> If Not objRecordSet.EOF then >> >> objRecordSet.MoveFirst >> >> End If >> >> fullPath = objRecordSet.Fields("distinguishedname").Value >> >> Set objUser = GetObject("LDAP://" + fulPath) >> >> objUser.SetPassword strPassword >> objUser.Put "PwdLastSet", -1 >> objUser.SetInfo >> >> If Err.Number <> 0 Then >> MsgBox "Error: An Incorrect User Name Was Entered!" >> Err.Clear >> Else >> MsgBox "The Password Has Been Changed For " & "\" & UCase(strUser) >> End If >> >> >> >> >> >> Curtis McKay >> >> Network Administrator >> >> Belleville Township High School District 201 >> >> [email protected] >> >> >> >> *From:* [email protected] [mailto: >> [email protected]] *On Behalf Of *Bill Purcell >> *Sent:* Monday, August 23, 2010 9:39 AM >> *To:* Tech-Geeks Mailing List >> *Subject:* Re: [tech-geeks] password reset >> >> >> >> I think the container is Bill Purcell >> >> but I tried billp and Bill Purcell it gives the error Error: An Incorrect >> User Name Was Entered >> >> Thanks >> >> On Mon, Aug 23, 2010 at 9:19 AM, McKay, Curtis <[email protected]> >> wrote: >> >> Is the person’s user name their container name? For our student’s that’s >> true, but for faculty it’s not. >> >> Example, my user name is “cmckay” but my container name is “McKay, >> Curtis”. If that’s the case we can still work through it. >> >> >> >> Curtis McKay >> >> Network Administrator >> >> Belleville Township High School District 201 >> >> [email protected] >> >> >> >> *From:* [email protected] [mailto: >> [email protected]] *On Behalf Of *Bill Purcell >> *Sent:* Monday, August 23, 2010 9:10 AM >> *To:* [email protected] >> *Subject:* [tech-geeks] password reset >> >> >> >> What is wrong with this script? >> >> >> >> >> >> I want to be able to have someone reset password to p...@550rd1 and make >> them change it next login... >> >> >> >> >> strUser = InputBox ("Enter User Name") >> strPassword = " p...@550rd1" >> >> On Error Resume Next >> >> Set objUser = GetObject("LDAP://cn=strUser, ou=one, ou=two, ou=three, >> ou=us, dc=where, dc=pvt") >> >> objUser.SetPassword strPassword >> objUser.Put "PwdLastSet", -1 >> objUser.SetInfo >> >> If Err.Number <> 0 Then >> MsgBox "Error: An Incorrect User Name Was Entered!" >> Err.Clear >> Else >> MsgBox "The Password Has Been Changed For " & "\" & UCase(strUser) >> End If >> >> >> >> >> >> TIA >> -- >> Bill Purcell >> ROE #10 >> >> >> | Subscription info at http://www.tech-geeks.org | >> >> >> >> >> -- >> Bill Purcell >> ROE #10 >> >> >> | Subscription info at http://www.tech-geeks.org | >> >> >> >> >> -- >> Bill Purcell >> ROE #10 >> >> ------------------------------ >> THIS TRANSMISSION IS INTENDED AND RESTRICTED FOR USE BY THE ABOVE >> ADDRESSEE ONLY. IT MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION >> EXEMPT FROM DISCLOSURE UNDER FEDERAL OR STATE LAW. IN THE EVENT SOME OTHER >> PERSON OR ENTITY RECEIVES THIS TRANSMISSION, SAID RECIPIENT IS HEREBY >> NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION, OR DUPLICATION OF THIS >> TRANSMISSION OR ITS CONTENTS IS PROHIBITED. IF YOU SHOULD RECEIVE THIS >> TRANSMISSION IN ERROR, PLEASE CALL US IMMEDIATELY AT 309.827.6031, DELETE >> THE FILE FROM YOUR SYSTEM, AND DESTROY ANY HARD COPIES OF THIS TRANSMISSION. >> THANK YOU. >> >> Bloomington Public Schools School District87 >> Bloomington, Illinois >> >> | Subscription info at http://www.tech-geeks.org | >> > > > | Subscription info at http://www.tech-geeks.org | > -- Bill Purcell ROE #10
| Subscription info at http://www.tech-geeks.org |
