ad中判断用户帐号是否被锁定的方法(仅限于WIN2003)

代码
//user is a DirectoryEntry for our user account
 
string attrib = 
  
"msDS-User-Account-Control-Computed";
 
//this is a constructed attrib
user.RefreshCache(new string[]{attrib});
 
const int UF_LOCKOUT = 0x0010;
 
int flags = 
  (
int)user.Properties[attrib].Value;
 
if (Convert.ToBoolean(flags & UF_LOCKOUT))
{
  Console.WriteLine(
    
"{0} is locked out",
    user.Name
    );
}


posted on 2010-03-23 13:38  MoonWalker  阅读(273)  评论(0编辑  收藏  举报

导航