If you are having people set the password for others, then you will definitely need to use SetPassword. I was thinking you were talking about self-service. Ok, so SetPassword tries to reset the password in Windows 2000 in 3 ways:
1.) Using SSL and native LDAP
2.) Using Kerberos (requires Kerberos to be setup)
3.) Using NetUserSetInfo api call.
It tries all of them in order (obviously stopping if successful). What happens on Win2k, is that the first two fail and then it tries the last one. The problem is that the credentials specified on the DirectoryEntry sometimes (maybe always) do not transfer to this call. So, ASPNET account ends up making the call, and it will fail with the error you see.
Here is what you can try:
Try
Const ADS_UF_ACCOUNTDISABLE As Integer = &H2
Dim user As New DirectoryEntry() '(Pathname)
Dim entry As New DirectoryServices.DirectoryEntry("LDAP://Domain.com")
Dim Serchr As New System.DirectoryServices.DirectorySearcher(entry)
Serchr.Filter = ("(samAccountName=" & NetID & ")")
Dim sr as SearchResult = Serchr.FindOne()
If (Not(sr Is Nothing)) Then
user = sr.GetDirectoryEntry()
user.Username = "DOMAIN\Admin" 'valid Admin User
user.Password = "password"
user.AuthenticationType = AuthenticationTypes.Secure
'Reset Password
user.Invoke("SetPassword", NetID) 'THIS IS WHERE THE ERROR OCCURS
'Enable account
Dim flags As Integer = user.Properties("userAccountControl").Value
user.Properties("userAccountControl").Value = flags And Not ADS_UF_ACCOUNTDISABLE
user.CommitChanges()
'Change Password at next logon
user.Properties("passwordExpired").Item(0) = 1
user.CommitChanges()
End If
Catch ex As Exception
Message.Text = "Error Resetting password for " & NetID & ": " & ex.Message & ex.StackTrace
Exit Sub
End Try
Let me know if just adding the .Username and .Password works for you. If it doesn't, we can try a couple things that might fix it(one I know will).