• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8372
  • Last Modified:

The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements. (Exception from HRESULT: 0x800708C5)

string Username = this.txtLoginId.Text;
            string newpwd = txtNewPassword.Text.ToString();
            string oldpwd = txtOldPassword.Text.ToString();
            string domain = ConfigurationManager.AppSettings["DomainName"];

            PrincipalContext principalContext = null;
            try
            {
                principalContext = new PrincipalContext(ContextType.Domain, domain);
            }
            catch (Exception e)
            {
                MessageBox.Show("Failed to create PrincipalContext. Exception: " + e);
                Application.Exit();
            }

            UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(principalContext, Username);
            if (userPrincipal != null)
            {
               

                //System.DirectoryServices.AccountManagement.UserPrincipal u = new UserPrincipal(principalContext);
                System.DirectoryServices.AccountManagement.UserPrincipal u = UserPrincipal.FindByIdentity(principalContext, Username);

         
                //To allow User to Change Password
                u.UserCannotChangePassword = false;

                u.ChangePassword(oldpwd, newpwd);

                u.PasswordNeverExpires = true;
                u.Enabled = true;//By default User is Disabled in Domain

                u.Save();

            }


AND I am getting above error on changePassword.

What is the problem?
0
rajputamitd
Asked:
rajputamitd
  • 2
1 Solution
 
rajputamitdAuthor Commented:
If anybody post the comment,I'll reply on it tomorrow.
Thanks.
0
 
pivarCommented:
Hi,

Your system has requirements on how your password  should look like. And the password you input to ChangePassword doesn't meet those requirements.
Is it a local user or a domain user? If local you could change the policy if you got admin rights. If it's a domain user you'll have to talk to netadmin on what the requirements are.

/peter
0
 
rajputamitdAuthor Commented:
Thanks
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now