Get PDC Emulator in Active Directory using .NET

Get PDC Emulator

Imports System.DirectoryServices

Module Module1

 Sub Main()

  Dim strDomain As String = “dc=steve,dc=schofield,dc=com”

 End Sub

 Function GetPDC(ByVal strDomain As String) As String

  Dim Entry As DirectoryEntry
  Dim mySearcher As DirectorySearcher

   Entry = New DirectoryEntry(“LDAP://” & strDomain)
   mySearcher = New DirectorySearcher(Entry)
   mySearcher.Filter = “(&(objectClass=top))”
  Catch f As Exception
  End Try
 End Function
End Module

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: