【发布时间】:2010-05-19 21:26:24
【问题描述】:
使用 System.DirectoryServices.AccountManagement 锁定 Active Directory 用户对象的最佳方法是什么?我能够确定一个帐户是否被锁定使用..
UserPrincipal principal = new UserPrincipal(context);
bool locked = principal.IsAccountLockedOut();
如何锁定帐户?有没有其他方法可以做这样的事情......
UserPrincipal principal = new UserPrincipal(context);
DirectoryEntry entry = (DirectoryEntry)principal.GetUnderlyingObject();
int val = (int)entry.Properties["userAccountControl"].Value;
entry.Properties["userAccountControl"].Value = val | 0x0010;
entry.CommitChanges();
【问题讨论】:
-
看看这是否有帮助:lock AD user account
标签: c# .net asp.net active-directory ldap