Looking for some syntax for my console application that will allow me to change the password of a local user. I have tired the UserPrincipal class, and DirectoryEntry class, nothing seems to be working. Any ideas?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Oct 2, 2014, 10:11 AM EDT
Marc176 reputationPosted Oct 3, 2014, 7:14 AM EDT
VulpesRank #55 · 29.2K reputationPosted Oct 3, 2014, 7:39 AM EDT
Is this the same sort of problem you've had with your previous attempts?
Marc176 reputationPosted Oct 3, 2014, 7:45 AM EDT
VulpesRank #55 · 29.2K reputationPosted Oct 4, 2014, 2:50 AM EDT
Here's a nice article on Active Directory which includes some code to do that:
http://www.codemag.com/Article/1312041
I've put the code from this article into a console app below. I've used the generic way of getting the LDAP connection string in case you're not sure what yours is:
I'm not able to test this code as I'm not connected to AD but it does compile OK.