-
January 4th, 2010, 11:03 AM
#1
Reseting a users password via Active Directory using Visual Basic 2010..
Hi Guys im writing a little app to enable authorised staff to reset student passwords but having a few issues. . I am no expert and am now stuck!
The following code does not seem to error but also does not reset the password!
_________________________
Private Sub bt_pwd_reset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_pwd_reset.Click
tb_newpwd1.Text = GenPassword.ToString
Try
Dim username As String = TUserName.Text
Dim de As DirectoryEntry = New DirectoryEntry()
de.Path = "LDAP://10.33.0.25/OU=Staff_Users;dc=domain,dc=domain,dc=internal"
de.Username = "DOMAIN\username-admin"
de.Password = "domainpassword"
de.AuthenticationType = AuthenticationTypes.Secure
Dim deSearch As DirectorySearcher = New DirectorySearcher(de)
deSearch.SearchRoot = de
deSearch.Filter = ("(sAMAccountName=" & username & ")")
Dim results As SearchResultCollection = deSearch.FindAll()
If results.Count = 0 Then
message.Text = "Can not locate user name: " & username
message.Visible = True
Exit Sub
End If
With de
.InvokeSet("serPassword", "Password123")
' .Invoke("SetPassword", Password123)
.CommitChanges()
End With
de.Close()
Catch ex As Exception
message.Text = ex.ToString
End Try
lb_bigpwd.Text = tb_newpwd1.Text
End Sub
______________________________________________
Any help on this would be great!!
Thanks in advance
Anthony
-
January 4th, 2010, 07:21 PM
#2
Re: Reseting a users password via Active Directory using Visual Basic 2010..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|