Help resetting user account password in active directory

T

teejayem

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top