Platform SDK: Active Directory, ADSI, and Directory Services |
To enable this option, set the PasswordExpired attribute to one(1). Setting this attribute to 0 allows the user to log on without changing the password.
Set usr = GetObject("WinNT://Fabrikam/jsmith,user") usr.Put "PasswordExpired", CLng(1) ' user must change password usr.SetInfo
IADsUser *pUser; HRESULT hr; hr=ADsGetObject(L"WinNT://Fabrikam/jsmith,user", IID_IADsUser, (void**)&pUser); VARIANT var; VariantInit(&var); V_I4(&var)=1; V_VT(&var)=VT_I4; hr = pUser->Put(L"PasswordExpired",var); // user must change password hr = pUser->SetInfo(); VariantClear(&var); pUser->Release();