how to set password in activedirectory RRS feed

  • Question

  • User-1931844881 posted

    I'm using the code like below to change password. However, linke 3 always get an error: TargetInvocationException was unhandled by user code.

    The Innerexcption is: {"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"}

    Message: "Exception has been thrown by the target of an invocation."

    1    DirectoryEntry de = new DirectoryEntry(path);
    2    de.UsePropertyCache = false;
    3    de.Invoke("SetPassword", new object[] { password });
    4    de.Invoke("pwdLastSet", new object[] { nextLogon });
    5    de.CommitChanges();

    Anybody knows why?

    Tuesday, January 6, 2009 3:22 PM


  • User1695803477 posted

    The user probably does not have permission to Set Password or to write to the property pwdLastSet.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 11, 2009 8:39 AM