469,572 Members | 1,306 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

Help resetting user account password in active directory

Hi.

I have searched the groups and have been unable to find an answer to
my question.

I am trying to reset the password of a user account in active
directory.

I have been trying to do this using the following code:-

Private Sub ResetPassword(ByVal User As String, ByVal NewPassword
As String)
Dim objUser As DirectoryServices.DirectoryEntry
Dim strDomain As String

strDomain = GetDomainName()

objUser = New DirectoryServices.DirectoryEntry("WinNT://" &
strDomain & "/" & User & ",User")

Dim objPassword As Object() = {NewPassword}

objUser.Invoke("SetPassword", objPassword)

objUser.CommitChanges()

objUser.Close()

objUser.Dispose()

End Sub

Private Function GetDomainName() As String
Return System.Environment.UserDomainName
End Function

I do not get any errors but it doesn't work.
Can anyone see where i am going wrong?
The computer i am running the application on is a member of a server
2003 active directory domain and is a member of the Administrators
group.

Any help is much appreciated.

Cheers,

Tom.

Apr 22 '07 #1
0 1054

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Tim::.. | last post: by
9 posts views Thread by webrod | last post: by
1 post views Thread by Carlettus | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.