DirectoryEntry to change password: Different behavior between Vista/Server2008
Posted
by Gnucom
on Stack Overflow
See other posts from Stack Overflow
or by Gnucom
Published on 2010-04-11T01:37:48Z
Indexed on
2010/04/11
1:43 UTC
Read the original article
Hit count: 559
c#
|change-password
Hey everyone,
On a Vista dev machine I used this code successfully to change user "Administrator" password:
directoryEntry.Invoke("SetPassword", "new");
When I moved it over to my Server 2008 dev machine that code did not work, and I was forced to use the following code:
directoryEntry.Invoke("ChangePassword", new object[] { "old", "new" });
My question is, why?
For both cases, I created my DirectoryEntry object as such:
DirectoryEntry directoryEntry = new DirectoryEntry(string.Format("WinNT://{0}/{1}", computerName, username));
Thanks! 8)
© Stack Overflow or respective owner