zerokool

zerokool

  • NA
  • 1
  • 0

Modifying AD passwords

Feb 20 2004 7:44 PM
I have some code that seems to work as far as auth'ing on the target domain, but for what ever reason it will not find the user object I am attempting to change the password on. I had a similar issues with PHP when attempting a similare thing, I was hoping the C# would be able to handle the job since it would have easy access to ADSI and what not... string inPassword = txtPassword.ToString(); string inUsername = txtUsername.ToString(); string UserPath= "LDAP://SERVER.DOMAIN.COM:389/CN=USERNAME,CN=users,DC=DOMAIN,DC=COM"; try { DirectoryEntry adEntry= new DirectoryEntry(UserPath,"DOMAIN\\Administrator","PASSWORD"); adEntry.Invoke("SetPassword", new object[]{inPassword}); adEntry.CommitChanges(); adEntry.RefreshCache(); } catch(Exception ex) { lblSuccessFail.Text = ex.Message.ToString(); } The error that is returned is: There is no such object on the server ; So i am assuming one of two things 1) my ldap path is wrong (pretty sure that is not it) 2) the domain administrator that I am using for the target domain does not have access to its on AD (again ... pretty sure that aint it .. ) So im outa ideas... Anyone else have some insight?