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. The following code examples show how to set the account lockout to FALSE.

Example Code [Visual Basic]

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

Example Code [C++]

IADsUser *pUser = NULL;

HRESULT hr = S_OK;
LPWSTR adsPath = L"WinNT://Fabrikam/JeffSmith";

hr = ADsGetObject(adsPath,IID_IADsUser,(void**)&pUser);

if(SUCCEEDED(hr))
{
	hr = pUser->put_IsAccountLocked(FALSE);
	hr = pUser->SetInfo();
}

if(pUser)
		hr = pUser->Release();