AdvancedFilters.BadLogonCount(Int32, MatchType) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the query filter for the BadLogonCount attribute to the specified value and comparison type.
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)
Parameters
- badLogonCount
- Int32
An integer.
- match
- MatchType
A MatchType that specifies how badLogonCount
should be compared to the attribute's value.
Examples
// 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);
}
Applies to
See also
Tee yhteistyötä kanssamme GitHubissa
Tämän sisällön lähde on GitHubissa, jossa voit myös luoda ja tarkastella ongelmia ja pull-pyyntöjä. Katso lisätietoja osallistujan oppaasta.