Partager via


AdvancedFilters.LastBadPasswordAttempt(DateTime, MatchType) Méthode

Définition

Définit le filtre de requête de l’attribut LastBadPasswordAttempt sur DateTime et la valeur de comparaison spécifiés.

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)

Paramètres

lastAttempt
DateTime

Objet DateTime.

match
MatchType

MatchType qui spécifie la façon dont lastAttempt doit être utilisé dans la comparaison.

Exemples

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

Remarques

L’heure par défaut est UTC. Si vous souhaitez spécifier l’heure en heure locale, spécifiez la Kind propriété de votre DateTime objet en tant que DateTimeKind.Local.

S’applique à

Voir aussi