Benutzer muss sein Passwort ändern: Beispielcode

Home Admin / Win2000 / Knowledge / Passwort ändern  
 

User Must Change Password at Next Logon

To enable this option, set the pwdLastSet attribute to zero(0). To clear this flag, set the attribute to -1.

Example Code [Visual Basic]

Set usr = GetObject("LDAP://CN=John Smith, OU=Sales, DC=Acme, DC=Com")
usr.Put "pwdLastSet", CLng(0)
usr.SetInfo

Example Code [C++]

IADsUser *pUser;
HRESULT hr;

hr=ADsGetObject(L"LDAP://cn=John Smith,cn=users,dc=ArcadiaBay,dc=com",
                IID_IADsUser,
                (void**)&pUser);
VARIANT var;
VariantInit(&var);
V_I4(&var)=0;
V_VT(&var)=VT_I4;
hr = pUser->Put(L"pwdLastSet",var);
hr = pUser->SetInfo();

VariantClear(&var);
pUser->Release();