tips & tricks


Calendario
giugno 2025
lmmgvsd
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

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: 16.964
  • Views Posts: 60.922
  • Views Gallerie: 2.852
  • n° Posts: 117
  • n° Commenti: 1
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003