Platform SDK: Active Directory, ADSI, and Directory Services |
To enable this option, set the UF_DONT_EXPIRE_PASSWD(0x10000) bit on the userAccountControl attribute.
Set usr = GetObject("LDAP:// CN=Jsmith, OU=Sales, DC=Fabrikam, DC=Com") flag = usr.Get("UserAccountControl") newFlag = flag Or ADS_UF_DONT_EXPIRE_PASSWD usr.Put "userAccountControl", newFlag usr.SetInfo
#include <activeds.h> IADsUser *pUser; VARIANT var; VariantInit(&var); HRESULT hr = S_OK; LPWSTR adsPath; adsPath=L"LDAP://serv1/cn=Jeff Smith,cn=Users, dc=Fabrikam, dc=com"; hr = ADsGetObject(adsPath,IID_IADsUser,(void**)&pUser); hr = pUser->Get(L"userAccountControl",&var); V_I4(&var) |= ADS_UF_DONT_EXPIRE_PASSWD; hr = pUser->Put(L"userAccountControl",var); hr = pUser->SetInfo(); VariantClear(&var); hr = pUser->Release();