Monthly Archives: October 2004
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”
GetPDC(strDomain)
End Sub
Function GetPDC(ByVal strDomain As String) As String
Dim Entry As DirectoryEntry
Dim mySearcher As DirectorySearcher
Try
Entry = New DirectoryEntry(“LDAP://” & strDomain)
mySearcher = New DirectorySearcher(Entry)
mySearcher.Filter = “(&(objectClass=top))”
Console.WriteLine(mySearcher.SearchRoot.Properties.Item(“fsmoroleowner”).Value)
Catch f As Exception
Console.WriteLine(f.Message)
End Try
End Function
End Module