Displays the name of the Primary Domain Controller (PDC) role holder for a specified domain. Script contributed by Microsoft's Mike Stephens and Judith Herman.

Visual Basic
Edit|Remove
domainName = "contoso.com"

set oDomain = GetObject("LDAP://" & domainName)
set oPdcNTDS = GetObject("LDAP://" & oDomain.fsmoRoleOwner) 
set oPDC = GetObject(oPdcNTDS.Parent)

WScript.Echo "PDC Role is owned by " & oPDC.dnsHostName

WScript.Quit()