获取密码到期日期 [英] get password expiration date

查看:85
本文介绍了获取密码到期日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



有没有其他方法可以找出用户testi的密码到期日期?

我试过这个:

Hello guys

Is there any other way to find out the password expiration date of the user "testi"?
I tried this:

using (var userEntry = new DirectoryEntry(configurationProvider.Configuration.DomainName + ",testi")
{
  var passwordExpDate = userEntry.InvokeGet("PasswordExpirationDate");
}



我感谢您的帮助。



祝你好运

v_tigra


I appreciate every help.

Best regards
v_tigra

推荐答案

尝试这样:

Try like this way:
public static DateTime GetPasswordExpirationDate(string userId, string domainOrMachineName)
{
    using (var userEntry = new DirectoryEntry("WinNT://" + domainOrMachineName + '/' + userId + ",user"))
    {
        return userEntry.InvokeGet("PasswordExpirationDate");
    }
}


这篇关于获取密码到期日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆