Requesting their support if I can guide in order to obtain a list of users that is soon to expire your account on my active directory.
问问题
684 次
1 回答
1
See this great MSDN magazine article Managing Directory Security Principals in the .NET Framework 3.5
In section 8, the authors talk about how to query for common things like finding users whose accounts will expire in a given period of time.
By doing something quite simple like this, you can find all users whose account will expire by Dec 15:
// establish domain context
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
// find users whose accounts will expire by Dec 15
PrincipalSearchResult<UserPrincipal> users =
UserPrincipal.FindByExpirationTime(ctx, new DateTime(2010, 12, 15),
MatchType.LessThanOrEquals);
Now you have a list of UserPrincipal
accounts that will expire soon.
于 2010-12-02T20:03:06.470 回答