Updating password of user in active Directory using C#

1

I am trying to change the password of a particular user you can find code below

var directoryEntryObject = new DirectoryEntry("LDAP://<IP>","administraor", "password");
baseObject.directoryEntryObject.Invoke("SetPassword", new object[] { "test@123" });
baseObject.directoryEntryObject.Properties["LockOutTime"].Value = 0;
baseObject.directoryEntryObject.Close();

Now i am getting below Error ::

Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))

c#
active-directory
asked on Stack Overflow Nov 7, 2013 by Himanshu.Parkash • edited Nov 7, 2013 by Liam

1 Answer

0

administraor -> is this the real username you are trying? Check the spelling of the username, it is administrator.

If you just typed here with this mistake, try

var directoryEntryObject = 
        new DirectoryEntry("LDAP://<IP>/Dc=domain,DC=local","administrtaor", "password");
answered on Stack Overflow Nov 7, 2013 by Albert • edited Nov 7, 2013 by Liam

User contributions licensed under CC BY-SA 3.0