Sdílet prostřednictvím


AdvancedFilters.LastPasswordSetTime(DateTime, MatchType) Metoda

Definice

Nastaví filtr dotazu pro LastPasswordSet atribut na zadanou DateTime a zadanou porovnávanou hodnotu.

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)

Parametry

passwordSetTime
DateTime

Objekt DateTime .

match
MatchType

A MatchType , který určuje, jak passwordSetTime se má použít při porovnání.

Příklady

// 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();  
}  

Poznámky

Výchozí čas bude UTC. Pokud chcete zadat čas v místním čase, zadejte vlastnost objektu KindDateTime jako DateTimeKind.Local.

Platí pro

Viz také