I am new to LDAP. I am trying to list all NT domain names. By NT domain names, I mean the domain names that you find on the LAN. This can be observed on Windows XP machines when you try to log in to this computer (i.e., the Login dialog after pressing Ctrl + Alt + Del). Usually we select the domain name in the last drop-down list after entering the credentials.
I looked at this post and could not do anything. I donβt know what it is . The code provided in the message does this with rootdse. However, I have a specific server for request and request, and I consider it a domain controller. (Maybe I'm wrong). We are writing something like rootDSE
LDAP://<domain_name>/dc=<domain>,dc=org
As indicated in the post, I tried to find a property with a name rootDomainNamingContext. But I could not find him. Then I tried the following code:
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
I do not know what exactly to look for on the output that I received. I got the output:
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,
I really need a guide here.
UPDATE
I used the code below to get the domains:
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
Now the problem is doubled. First, domain name inconsistencies. Suppose my DNS name is DC prod.domain.comand the expected domain names are for example dev, domain, etc. Instead, I get dev.domain.org, domain.org, etc. Some names that appear in the login window, when prompted, are displayed with a suffix domain.org; some have a suffix .org.
The second problem is not all domain names (which appear in the Windows login dialog, the third snapshot). I wonder why this is so.
UPDATE
, ( ) , dc .