AdvancedFilters.LastPasswordSetTime(DateTime, MatchType) Метод

Определение

Задает фильтр запроса для атрибута LastPasswordSet указанного параметра DateTime и заданное значение для сравнения.

public:
 void LastPasswordSetTime(DateTime passwordSetTime, System::DirectoryServices::AccountManagement::MatchType match);
public void LastPasswordSetTime (DateTime passwordSetTime, System.DirectoryServices.AccountManagement.MatchType match);
member this.LastPasswordSetTime : DateTime * System.DirectoryServices.AccountManagement.MatchType -> unit
Public Sub LastPasswordSetTime (passwordSetTime As DateTime, match As MatchType)

Параметры

passwordSetTime
DateTime

Объект DateTime.

match
MatchType

MatchType — указывает, как passwordSetTime может использоваться для сравнения.

Примеры

// Create the principal context for the usr object.  
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "fabrikam.com", "CN=Users,DC=fabrikam,DC=com", "administrator", "SecurelyStoredPassword");  

// Create the principal user object from the context  
UserPrincipal usr = new UserPrincipal(ctx);  

// Set the advanced query filter  
usr.AdvancedSearchFilter.LastPasswordSetTime(DateTime.Now.AddDays(-30), MatchType.LessThan);  

// Create a PrincipalSearcher object.  
PrincipalSearcher ps = new PrincipalSearcher(usr);  
PrincipalSearchResult<Principal> results = ps.FindAll();  

//Force users who have not changed their password in the last  
//30 days to do so at next logon  
foreach (UserPrincipal u in results)  
{  
	u.ExpirePasswordNow();  
	u.Save();  
}  

Комментарии

Время по умолчанию будет в формате UTC. Если вы хотите указать время в местном времени, укажите Kind свойство объекта DateTime как DateTimeKind.Local.

Применяется к

См. также раздел