TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Darren Young
NA
5
0
UserPrincipal.FindByPasswordSetTime Method
May 21 2010 5:10 PM
I have the following method that works but always returns excessively large result sets. We have around 38,000 user objects in AD and based on queries of PwdLastSet many of the entries returned by this method clearly don't expire. Thoughts?
public static List<string> getExpiringPasswordEntries(int days)
{
MethodBase mbo = System.Reflection.MethodBase.GetCurrentMethod();
Debug.WriteLine(mbo.Name + ": Entering");
List<string> returnList = new List<string>();
DateTime dt = DateTime.Today.AddDays(days);
Debug.Print(mbo.Name + ": dt val " + dt.ToString());
Debug.Print(mbo.Name + ": getting list of passwords that expire in " + days + " days");
try
{
PrincipalContext adPrincipalContext = new PrincipalContext(ContextType.Domain, "gsb.uchicago.edu");
PrincipalSearchResult<UserPrincipal> results =
UserPrincipal.FindByPasswordSetTime(
adPrincipalContext,
dt,
MatchType.LessThanOrEquals);
foreach (UserPrincipal result in results)
{
returnList.Add(result.SamAccountName);
//Debug.WriteLine(mbo.Name + ": " + result.SamAccountName);
}
Debug.WriteLine(mbo.Name + ": Returning");
return returnList;
}
catch
{
throw;
}
}
Reply
Answers (
0
)
Error occured when i call method in my web service(2)
code for logout button?