AdvancedFilters.BadLogonCount(Int32, MatchType) 方法    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将 BadLogonCount 属性的查询筛选器设置为指定的值和比较类型。
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 -> unitPublic Sub BadLogonCount (badLogonCount As Integer, match As MatchType)参数
- badLogonCount
- Int32
一个整数。
示例
// 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);  
}