Advertisement

11.27.2008 at 04:24AM PST, ID: 23940122 | Points: 250
[x]
Attachment Details

Password lock out issue in Active directory

Hi,
I have issue when i use the LDAP to connect to Active directory.My domainlock out policy is set as 10 invalid logon but when i use the code with th incorrect password 5 times it gets locked out.One wrong login is taken as 2 wrong login.

I get the error in the folowing line of the code when taking the user information to the recordset
Set recADSI = comADSI.Execute
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
'The Fully qualified domain name(DomainDNSName) will be taken from Windows Registry
 
    nSlashPos = InStr(strUserID, "\")
    If nSlashPos <> 0 Then
        'Get domain name
        strDomain = Mid$(strUserID, 1, nSlashPos - 1)
        'Get User ID
             
        strUserID = Mid$(strUserID, nSlashPos + 1, Len(strUserID) - nSlashPos)
        If LTrim(RTrim(gstrLogValidation)) <> "0" Then
            ValidateLog "Given User ID: " & strUserID
        End If
        gstrDomain = strDomain
    Else
        gstrDomain = objSystemInfo.DomainDNSName
     End If
    
    'The Microsoft ADSI Provider allows ADO, read only access to active directory services
    'To connect to this provider, set the Provider property of connection object  as "ADSDSOObject"
    
    Set conADSI = New ADODB.Connection
    conADSI.Provider = "ADsDSOObject"
    conADSI.Properties("User Id") = strUserID
    conADSI.Properties("Password") = strPassword
    conADSI.Properties("Encrypt Password") = True
    conADSI.open "DS query"
    
    strSearchString = "SELECT ADSpath " & " FROM 'LDAP://" & gstrDomain & "' WHERE " & _
        "sAMAccountName = '" & strUserID & "'"
    
    Set comADSI = New ADODB.Command
    Set comADSI.ActiveConnection = conADSI
 
    'This following will be executed only when User ID/Password are valid
    'otherwise permission denied excetion will be arised
    comADSI.CommandText = strSearchString
    Set recADSI = comADSI.Execute
    
    strTemp = recADSI("ADSPath")
Top Expert: Netman66
Expert Since: 01/09/2003
Accepted Solutions: 3788
Computer Expertise: Beginner
Netman66 has been an Expert for 6 years, during which he has posted 16263 comments and answered 3788 questions. Netman66 is just one of 447 experts in the Lightweight Directory Access Protocol (LDAP) Zone.
 
 
 
 
20081119-EE-VQP-48 - Hierarchy / EE_QW_2_20070628