活动目录 - 检查密码永不过期? [英] Active Directory - check if password never expires?
本文介绍了活动目录 - 检查密码永不过期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在Visual Basic中检查,如果用户的密码设置为永不过期在Active Directory?
我已经找到一种方法找到它上次更改日期,但我找不到其他可用的选项。
昏暗德作为DirectoryServices.DirectoryEntry =的getUser(uDetails.username)
昏暗objUser = GetObject的(de.Path)
如果objUser.PasswordLastChanged< DateTime.Now.AddMonths然后(-3)
...
我在哪里可以找到所有可用的 objUser
属性的列表?
解决方案
公共BOOL isPasswordExpired(字符串p_UserName,字符串p_DomainName)
{
布尔m_Check = FALSE;
INT m_Val1 =(int)的de1.Properties [userAccountControl的]值。
INT m_Val2 =(INT)0x10000的;
如果(Convert.ToBoolean(m_Val1&安培; m_Val2))
{
m_Check =真;
} //结束
返回m_Check
}
Is there a way in Visual Basic to check if the user's password is set to never expire in Active Directory?
I've found a way to find the last date it was changed, but I can't find the other available options.
Dim de As DirectoryServices.DirectoryEntry = GetUser(uDetails.username)
Dim objUser = GetObject(de.Path)
If objUser.PasswordLastChanged < DateTime.Now.AddMonths(-3) Then
...
Where can I find a list of all available objUser
properties?
解决方案
public bool isPasswordExpired(String p_UserName, String p_DomainName)
{
bool m_Check=false;
int m_Val1 = (int)de1.Properties["userAccountControl"].Value;
int m_Val2 = (int) 0x10000;
if (Convert.ToBoolean(m_Val1 & m_Val2))
{
m_Check = true;
} //end
return m_Check
}
这篇关于活动目录 - 检查密码永不过期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文