Problems with a simple password reset program in VB6
First let me tell you my scenario. I am a technician at a secondary school. We have a medium sized network with AD, running server 2003 and XP clients.
I am trying to create a very simple VB6 executable that will reset a students password and force a password change at next logon. I'm no expert at VB but I can work my way around a program.
I have designed the very simple form: see attached
Here is the code:
When I run it, I enter the student's number in the text box and click submit, then and error is thrown at me.
Private Sub cmdExit_Click()
Private Sub cmdSubmit_Click()
Dim objOU As Object, objUser As Object, objRootDSE As Object
Dim strContainer As String, strDNSDomain As String, strPassword As String
Dim intPwdValue As Integer
'Bind to Active Directory Domain
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.get("DefaultNamingContext")
strContainer = "OU=Domain Users, "
strPassword = "P@ssw0rd"
strContainer = strContainer & strDNSDomain
'Here we force a change of password at next logon
intPwdValue = 0
Set objOU = GetObject("LDAP://cn=" & txtStuNum.Text & ", " & strContainer)
objUser.Put "PwdLastSet", intPwdValue
"Run-time error '2147016656 (80072030)': There is no such object on the server"
When I debug, the "Set objOU = GetObject("LDAP://cn=" & txtStuNum.Text & ", " & strContainer)" line is highlighted in yellow.
Any help to get this working would be greatly appreciated.
Cheers for looking,