如何使用 lockoutTime 解锁 AD 中的用户帐户
我想通过将 lockoutTime 属性设置为零来解锁 AD 中的用户帐户。问题在于该属性的值是 System_ComObject。如何将属性值设置为零?我使用以下代码来获取 lockOut
的值。
DirectoryEntry user = DirectoryEntry(DistinguishedName);
//user.Properties["lockoutTime"].Value is a System_Com object
long fileTicks = LongFromLargeInteger(user.Properties["lockoutTime"].Value);
private long LongFromLargeInteger(object largeInteger)
{
System.Type type = largeInteger.GetType();
type = largeInteger.GetType();
int highPart = (int)type.InvokeMember("HighPart",
BindingFlags.GetProperty, null, largeInteger, null);
int lowPart = (int)type.InvokeMember("LowPart", BindingFlags.GetProperty, null, largeInteger, null);
return (long)highPart << 32 | (uint)lowPart;
}
I want to unlock user account in AD by setting the lockoutTime attribute to zero. The problem is that the value of the property is a System_ComObject. How do I set the value of the attribute to zero? I have used the following code to get the value of lockOut
.
DirectoryEntry user = DirectoryEntry(DistinguishedName);
//user.Properties["lockoutTime"].Value is a System_Com object
long fileTicks = LongFromLargeInteger(user.Properties["lockoutTime"].Value);
private long LongFromLargeInteger(object largeInteger)
{
System.Type type = largeInteger.GetType();
type = largeInteger.GetType();
int highPart = (int)type.InvokeMember("HighPart",
BindingFlags.GetProperty, null, largeInteger, null);
int lowPart = (int)type.InvokeMember("LowPart", BindingFlags.GetProperty, null, largeInteger, null);
return (long)highPart << 32 | (uint)lowPart;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要做的就是:
All you need to do is this: