<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Here's the code that I use to reset the password, having opened the
    ADS connection using an <a class="moz-txt-link-rfc2396E" href="LDAP://">"LDAP://"</a> string.<br>
    <div class="moz-forward-container"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p></o:p></span>
      <div class="Section1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">var<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;
            UserObject: IADsUser;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">...<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;
            if UserObject.AccountDisabled then<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;
            begin<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            FErrorMessages.Add(Format('Cannot
            reset password, AD user account for %s is disabled',
            [FUserDN]));<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            Exit(false);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;
            end;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;
            UserObject.SetPassword(FNewPassword);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;
UserObject.SetInfo;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            (* Complete the operation to
            update the user object. *)<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;
            UserObject := nil;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">...<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>Hope
              this helps<br>
            </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>D
              <br>
            </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
        <br>
        <div>
          <table class="MsoNormalTable" border="0" cellpadding="0"
            cellspacing="0">
            <tbody>
              <tr>
                <td style="padding:0cm 0cm 0cm 0cm" nowrap="nowrap"
                  valign="top">
                  <p class="MsoNormal" style="text-align:right"
                    align="right"><b>Subject: <o:p></o:p></b></p>
                </td>
                <td style="padding:0cm 0cm 0cm 0cm">
                  <p class="MsoNormal">Re: [DUG] IADsUser Change
                    Password<o:p></o:p></p>
                </td>
              </tr>
              <tr>
                <td style="padding:0cm 0cm 0cm 0cm" nowrap="nowrap"
                  valign="top">
                  <p class="MsoNormal" style="text-align:right"
                    align="right"><b>Date: <o:p></o:p></b></p>
                </td>
                <td style="padding:0cm 0cm 0cm 0cm">
                  <p class="MsoNormal">Wed, 16 Jan 2013 19:46:27 +1300<o:p></o:p></p>
                </td>
              </tr>
              <tr>
                <td style="padding:0cm 0cm 0cm 0cm" nowrap="nowrap"
                  valign="top">
                  <p class="MsoNormal" style="text-align:right"
                    align="right"><b>From: <o:p></o:p></b></p>
                </td>
                <td style="padding:0cm 0cm 0cm 0cm">
                  <p class="MsoNormal">David O'Brien <a
                      moz-do-not-send="true"
                      href="mailto:Dave@iccs.co.nz">&lt;Dave@iccs.co.nz&gt;</a><o:p></o:p></p>
                </td>
              </tr>
              <tr>
                <td style="padding:0cm 0cm 0cm 0cm" nowrap="nowrap"
                  valign="top">
                  <p class="MsoNormal" style="text-align:right"
                    align="right"><b>Reply-To: <o:p></o:p></b></p>
                </td>
                <td style="padding:0cm 0cm 0cm 0cm">
                  <p class="MsoNormal">NZ Borland Developers Group -
                    Delphi List <a moz-do-not-send="true"
                      href="mailto:delphi@listserver.123.net.nz">&lt;delphi@listserver.123.net.nz&gt;</a><o:p></o:p></p>
                </td>
              </tr>
              <tr>
                <td style="padding:0cm 0cm 0cm 0cm" nowrap="nowrap"
                  valign="top">
                  <p class="MsoNormal" style="text-align:right"
                    align="right"><b>To: <o:p></o:p></b></p>
                </td>
                <td style="padding:0cm 0cm 0cm 0cm">
                  <p class="MsoNormal">NZ Borland Developers Group -
                    Delphi List <a moz-do-not-send="true"
                      href="mailto:delphi@listserver.123.net.nz">&lt;delphi@listserver.123.net.nz&gt;</a><o:p></o:p></p>
                </td>
              </tr>
            </tbody>
          </table>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Great
              thanks, I don&#8217;t want to reset at next login, just
              change the password, so that shouldn&#8217;t be a problem.</span><o:p></o:p></p>
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0cm 0cm 0cm">
              <p class="MsoNormal"><b><span
                    style="font-size:10.0pt;font-family:
&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext" lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:windowtext"
                  lang="EN-US"> <a moz-do-not-send="true"
                    href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
                  [<a moz-do-not-send="true"
                    href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>]
                  <b>On Behalf Of </b>David Moorhouse<br>
                  <b>Sent:</b> Wednesday, 16 January 2013 5:35 p.m.<br>
                  <b>To:</b> <a moz-do-not-send="true"
                    href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
                  <b>Subject:</b> Re: [DUG] IADsUser Change Password</span><o:p></o:p></p>
            </div>
          </div>
          <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          <div>
            <p class="MsoNormal">I've done something similar but ran
              into problems when I
              forced a password change at the next login.&nbsp; Some AD rules
              only allow one
              password change per day !<br>
              <br>
              I'll look at some code tomorrow for you.<br>
              <br>
              D<br>
              <br>
              On 16/01/13 17:02, David O'Brien wrote:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I
                am attempting to put together an easy way for users to
                change
                domain password when they are out of the office, (or if
                they have a MAC).</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">IADSUser.Setpassword(NewPassword)
                works, but doesn&#8217;t do
                any checks.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">IADSUser.ChangePassword(OldPassword,
                NewPassword) checks that
                the old password is correct but always fails the new
                password with &#8220;The
                password does not meet the password policy
                requirements...&#8221; Doesn&#8217;t
                matter how complex I make the password.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Note:
                I can change the password normally on the domain without
                a
                problem, so I know the passwords I am trying to change
                to are complex enough.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Anyone
                played with this before?</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I
                am using:</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Var</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;
                User: IADsUser: </span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                ADsOpenObject( 'WinNT://' +
                edtUser.Text, '[Administrator]', '[admin password]', 1,
                IADsUser, User) ;</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                User.ChangePassword(edtPass.Text,
                'c0mpl!anse');</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Regards,</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Dave.</span><o:p></o:p></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;</span><o:p></o:p></p>
            <p class="MsoNormal"><br>
              <br>
              <br>
              <br>
              <o:p></o:p></p>
            <pre>_______________________________________________<o:p></o:p></pre>
            <pre>NZ Borland Developers Group - Delphi mailing list<o:p></o:p></pre>
            <pre>Post: <a moz-do-not-send="true" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><o:p></o:p></pre>
            <pre>Admin: <a moz-do-not-send="true" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><o:p></o:p></pre>
            <pre>Unsubscribe: send an email to <a moz-do-not-send="true" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<o:p></o:p></pre>
          </blockquote>
          <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
        </div>
        <br>
      </div>
    </div>
  </body>
</html>