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


你可能感兴趣的:(2003)