Search This Blog

VB.NET

Get Root Domain's distinguished name. Example: DC=pesky,DC=net

NameSpace:

Imports System.DirectoryServices

Code:

Dim rootdse As New DirectoryServices.DirectoryEntry"LDAP://RootDSE" )
Dim strDomain As String = rootdse.Properties( "defaultNamingContext" ).Value.ToString()
MessageBox.Show( strDomain )