Platform SDK: Active Directory, ADSI, and Directory Services |
To enable this option, set the UF_DONT_EXPIRE_PASSWD(0x10000) bit on the UserFlags attribute.
Set usr = GetObject("WinNT://Fabrikam/JSmith") flag = usr.Get("UserFlags") newFlag = flag Or ADS_UF_DONT_EXPIRE_PASSWD usr.Put "userFlags", newFlag usr.SetInfo
#include <activeds.h> IADsUser *pUser; VARIANT var; VariantInit(&var); HRESULT hr = S_OK; LPWSTR adsPath; adsPath=L"WinNT://Fabrikam/JSmith"; hr = ADsGetObject(adsPath,IID_IADsUser,(void**)&pUser); hr = pUser->Get(L"UserFlags",&var); V_I4(&var) |= ADS_UF_DONT_EXPIRE_PASSWD; hr = pUser->Put(L"UserFlags",var); hr = pUser->SetInfo(); VariantClear(&var); hr = pUser->Release();