Sdílet prostřednictvím


AdvancedFilters.LastBadPasswordAttempt(DateTime, MatchType) Metoda

Definice

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

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

Parametry

lastAttempt
DateTime

Objekt DateTime .

match
MatchType

Parametr , MatchType který určuje, jak lastAttempt se má použít v 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.LastBadPasswordAttempt(DateTime.Now.AddDays(-1), MatchType.GreaterThan);  

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

//Write the name of all users whose most recent incorrect  
//password entry was within the last day  

foreach (UserPrincipal u in results)  
{  
	Console.WriteLine(u.Name);  
}  

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é