Platform SDK: Active Directory, ADSI, and Directory Services

Account Lockout

You can only set the account lockout to FALSE. Only the system can set the account lockout to TRUE. You can also read the value of the account lockout.

Example Code [Visual Basic]

Set usr = GetObject("WinNT://Fabrikam/JSmith")
usr.IsAccountLocked = FALSE
usr.SetInfo

Example Code [C++]

IADsUser *pUser;

HRESULT hr = S_OK;
LPWSTR adsPath;
adsPath=L"WinNT://Fabrikam/JSmith";
hr = ADsGetObject(adsPath,IID_IADsUser,(void**)&pUser);

hr = pUser->put_IsAccountLocked(false);
hr = pUser->SetInfo();

hr = pUser->Release();