Account disabilitato (provider WinNT)
Quando si usa il provider WinNT, un account può essere abilitato o disabilitato usando la proprietà IADsUser.AccountDisabled.
Esempio 1
Nell'esempio di codice seguente viene illustrato come disabilitare un account usando Visual Basic con ADSI.
Dim usr as IADsUser
On Error GoTo Cleanup
Set usr = GetObject("WinNT://Fabrikam/JeffSmith")
usr.AccountDisabled = TRUE ' Disable the account.
usr.SetInfo
Cleanup:
If (Err.Number<>0) Then
MsgBox("An error has occurred. " & Err.Number)
End If
Set usr = Nothing
Esempio 2
L'esempio di codice seguente illustra come disabilitare un account con C++ con ADSI.
IADsUser *pUser;
HRESULT hr = S_OK;
LPWSTR adsPath;
adsPath=L"WinNT://Fabrikam/JeffSmith";
hr = ADsGetObject(adsPath, IID_IADsUser, (void**)&pUser);
hr = pUser->put_AccountDisabled(TRUE);
hr = pUser->SetInfo();