Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DirectoryEntry directoryEntry = new DirectoryEntry(ldaPath, domainName+"\"+ userName, Password);
- if (directoryEntry != null)
- {
- DirectorySearcher searchEntry = new DirectorySearcher(directoryEntry);
- searchEntry.Filter = "(SAMAccountname=" + userName + ")";
- SearchResult result = searchEntry.FindOne();
- if (result != null)
- {
- DirectoryEntry userEntry = result.GetDirectoryEntry();
- if (userEntry != null)
- {
- userEntry.Invoke("SetPassword", new object[] { newPassword });
- userEntry.Properties["lockouttime"].Value = 0;
- }
- }
- }
Add Comment
Please, Sign In to add comment