Change Active Directory User Password

How to change the password of an Active Directory user using the directory service without knowing the old password?

+3
source share
3 answers

You are probably looking for a method SetPasswordthat you should call on the object DirectoryEntry.

Check out the Reset User Password: Howto example here : (almost) everything in Active Directory through C # .

EDIT :
If you have problems with a null entry in the directory, you are likely to make a mistake. The path should be something like this:

DirectoryEntry entry = new DirectoryEntry("LDAP://CN=johndoe,CN=Users,DC=acme,DC=com");
+3
source

As an MCSE, I reset my password many times a day, so I can tell you about it.

, Active Directory - reset. , , , , , , reset .

, , Active Directory, , , , .

, , reset , reset, .

0

.net 3.5 System.DirectoryServices.AccountManagement. .

    public void ChangePassword(string dn, string newPassword)
    {
        using (var context = new PrincipalContext(ContextType.Domain))
        {
            using (var user = UserPrincipal.FindByIdentity(context, IdentityType.DistinguishedName, dn))
            {
                user.SetPassword(newPassword);
            }
        }
    }
0

Source: https://habr.com/ru/post/1767110/


All Articles