tips & tricks


Calendario
aprile 2024
lmmgvsd
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Change User Password in AD

Recuperare gli utenti in AD e fare il change della pwd.



 

                DirectoryEntry de = new DirectoryEntry(DC_LDAP_PATH, utente, vecchia, AuthenticationTypes.Secure);

                // Recupero il nodo utente

                DirectorySearcher deSearch = new DirectorySearcher();

                deSearch.SearchRoot = de;

                deSearch.Filter = "(&(objectClass=user)(SAMAccountName=" + utente + "))";

                deSearch.SearchScope = SearchScope.Subtree;

                SearchResult results = deSearch.FindOne();

                de = new DirectoryEntry(results.Path, utente, vecchia, AuthenticationTypes.Secure);

                // Eseguo il cambio password

                de.Invoke("ChangePassword", new object[] { vecchia, nuova });

 

Categoria: C#
giovedì, 22 set 2011 Ore. 14.55
Archivio Posts
Anno 2020

Anno 2018

Anno 2015

Anno 2013

Anno 2011

Anno 2010

Anno 2009

Anno 2008
Statistiche
  • Views Home Page: 13.282
  • Views Posts: 55.963
  • Views Gallerie: 2.837
  • n° Posts: 117
  • n° Commenti: 1
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003