如何使用C ++从AD获取密码过期日期 [英] How to get the password expired date from the AD using c++
本文介绍了如何使用C ++从AD获取密码过期日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨.
我使用c ++从广告中读取了显示名称和其他内容. (公元2003年)
但是我不知道如何获取特定用户的密码过期日期.
您能帮我吗..
Hi.
i read the display name , and other things from the ad using c++. (AD 2003)
But i don''t know how to get the password expired date for the specific user..
can you help me ..
推荐答案
您可以尝试以下代码段(来自 ^ ]):
You can try this code snippet (from IADsUser Property Methods[^]):
IADsUser *GetUserObject(LPWSTR uPath)
{
IADsUser *pUser;
HRESULT hr = ADsGetObject(uPath,IID_IADsUser,(void**)&pUser);
if (FAILED(hr)) {return NULL;}
BSTR bstr;
hr = pUser->get_FullName(&bstr);
printf("User: %S\n", bstr);
SysFreeString(bstr);
return pUser;
}
并添加:
And add:
DATE date;
hr = pUser->get_PasswordExpirationDate(&date);
printf("Date: %f\n", date);
最后,告诉我们这种尝试是否成功.
Finally, tell us if this attempt succeeded.
这篇关于如何使用C ++从AD获取密码过期日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文