Jump to content

goodami

Member
  • Posts

    1
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

Posts posted by goodami

  1. HI ,

    I have to find an operational attribute from Active Directoyry using VBsCript.I do not know how to get that since:

    1)It needs authentication form user.So how to connect to AD using Username & Password

    Below is the code:

    strBase = ";"

    strFilter = "(uid=test amit);"

    strAttrs = "adspath;"

    strScope = "subtree"

    Set directoryConn = CreateObject("ADODB.Connection")

    directoryConn.Provider = "ADsDSOObject"

    directoryConn.Open "Active Directory Provider"

    Set objRS = directoryConn.Execute(strBase & strFilter & strAttrs & strScope)

    Dim objUser

    While Not objRS.EOF

    Set objUser = GetObject(objRS.Fields("adspath").Value)

    objUser.GetInfo

    objUser.Get("uid")

    strEx = objUser.Get("cn")

    MsgBox strEx

    strADSPath = objRS.Fields("adspath").Value

    MsgBox strADSPath

    objRS.MoveNext

    Wend

    directoryConn.close

    Dim directoryConn1

    Dim objRS1

    Dim dn

    dn = "uid=" & objUser.Get("uid") & ",ou=people,dc=abc,dc=com"

    MsgBox dn

    '

    'Set dso = GetObject("LDAP:")

    'Set tmpUser = dso.OpenDSObject( strADSPath,"test amit","1234",1)

    'tmpUser.GetInfoEx Array("passwordexpirationtime"), 0

    'MsgBox tmpUser.Get("passwordexpirationtime")

    Set directoryConn1 = CreateObject("ADODB.Connection")

    directoryConn1.Provider = "ADsDSOObject"

    directoryConn1.Properties("User ID") = "test amit"

    directoryConn1.Properties("Password") = "1234"

    directoryConn1.Properties("Encrypt Password") = "FALSE"

    directoryConn1.Open "Active Directory Provider"

    strAttrs = "passwordexpirationtime;"

    strScope = "subtree"

    Set objRS1 = directoryConn1.Execute(strBase & strFilter & strAttrs & strScope)

    While Not objRS1.EOF

    Set objUser1 = GetObject(objRS1.Fields("adspath").Value)

    objUser1.GetInfo

    strEx1 = objUser1.Get("manager")

    MsgBox strEx1

    strEx = objUser1.Get("passwordexpirationtime")

    MsgBox strEx

    objRS.MoveNext

    Wend

    '

    'objRS1.close

    'directoryConn1.Close

×
×
  • Create New...