Hi francism8!

I do not claim any significant knowledge of Windows 2012 R2 AD (Active Directory). However, I hope by asking a few (perhaps "dumb") questions, that you may be able to see something that I do not? Your code looks fundamentally sound to me (the flow and error checking appear to be ok). The main difference appears to be in how the 2 servers are configured.

First, a lot changes happen by moving from LDAPS (Secure LDAP), port 636 in Win 2008 R2 to plain LDAP, port 389 in Win 2012. That direction is usually much easier than moving from a plain connection to an encrypted connection. I don't know why that change in connection protocol was done, but it appears to work.

As a rather bizarre idea, I considered the idea that your code is actually "working" as written, although it is not achieving the desired result (actual password change).

I do not know why you changed from setting "unicodePwd" to setting the "userPassword"? So I investigated that.

I found this on a site that I do not want to advertise here, but:

unicodePwd is the "real password attribute", That's what is used for user binds. It has a very specific formatting requirements. Whenever you set a value, it must be a unicode string enclosed in double quotes.

userPassword is "switchable". It can be turned into a regular attribute, or it can be turned into a write-alias for unicodePwd. AD by default has it as a regular attribute. When userPassword is a write-alias for unicodePwd, it is written as a regular value, no unicode, no double-quotes. However, passwords can never be read.

So one theory could be that you are successfully setting "userPassword" as a regular attribute. But that doesn't actually change the "unicodePwd" because AD (Active Directory) default for this field has not been configured as a write only alias for "unicodePwd". Essentially you change "userPassword", but it doesn't matter? There appear to be some formatting details when using the "unicodePwd" alias.

If you are able to read "userPassword", that would indicate that it is not an alias for "unicodePwd" because "real passwords" cannot be read. Try it and see what happens.

I looked at Microsoft site: unicodePwd attribute and this attribute appears to be the same between Win 2008 R2 and 2012 R2.

Hope these questions help you.


In reply to Re: It does not change password in LDAP Windows 2012 R2 by Marshall
in thread Resolved: It does not change password in LDAP Windows 2012 R2 by francism8

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.