i am working with AD Server,i want to get the maxpwdAge attribute value...
i already try ADSi for that,but it gives an issue.
VARIANT var;
bsNamingContext=L"maxpwdAge";
hr = ADsGetObject(pszADsPath, IID_IADsUser, (void**) &pUser);
if(SUCCEEDED(hr))
{
VariantInit(&var);
hr = pUser->Get(bsNamingContext, &var);
}
but,it gives -2147463155 (8000500d) error...
but i am using bsNamingContext=L"cn";
it gives the CN values correctly...
anyone can resolve it?
maxpwdAge is not included in user/contact/person LDAP class, so you can not retrieve it that way.
You need to query it from domain object, not user object
Try this:
UPDATE:
To convert large integer to human readable value use IADsLargeInteger dispatch interface
Note 1 : Example is in VB, but you can easily rewrite it, because of COM.
Note 2 : maxpwdAge is not configured per user, but per domain (until fine-grained password policies are enabled)
Further readings: