我是 LDAP 的新手。我正在尝试列出所有 NT 域名。我所说的 NT 域名是指您可以在 LAN 网络上找到的域名。当您尝试登录到该机器时,您可以在 windows xp 机器上观察到这一点(即按 ctrl+alt+del 后出现的登录对话框)。通常我们在输入凭据后在最后一个下拉菜单中选择域名。
我已经看过这个帖子,但无法从中得到任何东西。我不知道是什么rootDSE
。帖子中给出的代码使用 rootdse 完成。但是,我有一个特定的服务器要访问和查询,我认为它是一个域控制器。(我可能错了)。我们写了类似的东西
LDAP://<domain_name>/dc=<domain>,dc=org
正如帖子中给出的,我试图寻找一个名为rootDomainNamingContext
. 但我找不到它。然后我尝试了以下代码:
Sub Main()
Dim oRoot As DirectoryEntry = Nothing
'Dim oSearcher As DirectorySearcher
'Dim oResults As SearchResultCollection
Try
oRoot = New DirectoryEntry("LDAP://<domain_name>/dc=<domain>,dc=org")
For Each obj As String In oRoot.Properties.PropertyNames
Console.Write(obj + ", ")
Next
Catch ex As Exception
Console.Write(ex.Message)
Finally
oRoot.Dispose()
End Try
Console.Read()
End Sub
我不知道在我得到的输出中具体寻找什么。我得到的输出是:
objectClass, description, distinguishedName, instanceType, whenCreated, whenChan
ged, subRefs, uSNCreated, dSASignature, repsTo, repsFrom, uSNChanged, name, obje
ctGUID, replUpToDateVector, creationTime, forceLogoff, lockoutDuration, lockOutO
bservationWindow, lockoutThreshold, maxPwdAge, minPwdAge, minPwdLength, modified
CountAtLastProm, nextRid, pwdProperties, pwdHistoryLength, objectSid, uASCompat,
modifiedCount, auditingPolicy, nTMixedDomain, rIDManagerReference, fSMORoleOwne
r, systemFlags, wellKnownObjects, objectCategory, isCriticalSystemObject, gPLink
, gPOptions, masteredBy, ms-DS-MachineAccountQuota, msDS-Behavior-Version, msDS-
PerUserTrustQuota, msDS-AllUsersTrustQuota, msDS-PerUserTrustTombstonesQuota, ms
Ds-masteredBy, dc, nTSecurityDescriptor,
我真的需要这里的指导。
更新
我使用下面的代码来获取域:
Dim dc As New DirectoryContext(DirectoryContextType.DirectoryServer, DcIpAddr)
Dim domc As DomainController = DomainController.GetDomainController(dc)
For Each dmn As Domain In domc.Forest.Domains
Console.WriteLine(dmn.Name)
Next
现在问题有两个方面。首先,域名不一致。假设我的 DC 的 DNS 名称是prod.domain.com
,并且预期的域名是例如dev, domain, etc
。相反,我得到dev.domain.org, domain.org, etc
. 一些出现在windows登录对话框中的名字,在被查询时,会出现后缀domain.org
;有些有后缀.org
。
第二个问题不是所有域名(出现在 Windows 登录对话框中,第 3 个下拉菜单中)都出现了。想知道为什么会这样?
更新
认为其他域(未出现)可能是另一个域控制器服务器的一部分,或者我需要使用适当的凭据访问 dc。