AdvancedFilters.BadLogonCount(Int32, MatchType) Metodo

Definizione

Imposta il filtro di query per l'attributo BadLogonCount sul valore e sul tipo di confronto specificati.

public:
 void BadLogonCount(int badLogonCount, System::DirectoryServices::AccountManagement::MatchType match);
public void BadLogonCount(int badLogonCount, System.DirectoryServices.AccountManagement.MatchType match);
member this.BadLogonCount : int * System.DirectoryServices.AccountManagement.MatchType -> unit
Public Sub BadLogonCount (badLogonCount As Integer, match As MatchType)

Parametri

badLogonCount
Int32

Un numero intero.

match
MatchType

Oggetto MatchType che specifica come badLogonCount deve essere confrontato con il valore dell'attributo.

Esempio

// 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
int badLogonThreshold = 3;
usr.AdvancedSearchFilter.BadLogonCount(badLogonThreshold, MatchType.GreaterThan);

// Create a PrincipalSearcher object.
PrincipalSearcher ps = new PrincipalSearcher(usr);
PrincipalSearchResult<Principal> results = ps.FindAll();
Console.WriteLine("The following users have logged on unsuccessfully at more than " + badLogonThreshold.toString + " times:");
foreach (UserPrincipal u in results)
{
  Console.WriteLine(u.Name);
}

Si applica a

Vedi anche