我已经创建了一个VB6程序,它将使用LDAP身份验证。但是在使用LDP.exe的服务器上也可以使用相同的身份验证,这既允许用户使用登录凭据,也可以不使用凭据。但是,当我尝试在客户端计算机(XP)时,它说:
域不存在。
Dim objGroup As IADsGroup
Dim strDN As String
Dim adsSystemInfo As IADsADSystemInfo
strDN = "CN=Users,dc=DomainName,dc=Net"
Set objGroup = GetObject("LDAP://" & strDN)
Set adsSystemInfo = CreateObject("ADSystemInfo")发布于 2015-04-15 20:11:43
参考项目中的activeds.tlb。用法:
With New ADSystemInfo
MsgBox ("Computer Name: " & .ComputerName)
MsgBox ("User Name: " & .UserName)
End With还可以使用ADO查询LDAP对象,如:
Dim oConn As New ADODB.Connection
Dim oRS As New ADODB.Recordset
Dim oField As ADODB.Field
Dim iP As IADs
oConn.Provider = "ADsDSOObject"
oConn.CursorLocation = adUseNone
oConn.Open "Active Directory Provider"
oRS.CursorLocation = adUseClient
oRS.Open "Select * from 'LDAP://domain'", oConn, adOpenStatic, adLockReadOnly
Set iP = GetObject(oRS(0).Value)
While Not oRS.EOF
For Each oField In oRS.Fields
List1.AddItem oField.Name & " / " & oField.Value
Next
oRS.MoveNext
Wend
oRS.Close
Set oRS = Nothinghttps://stackoverflow.com/questions/29659465
复制相似问题