Find PDC Emulator role holder
Is there a way locate the server with the PDCE role using VBScript? I know I can use an NSLOOKUP and capture its output
n开发者_如何学运维slookup -type=all _ldap._tcp.pdc._msdcs.mydomain.com
I want to use VBScript wihout calling external programs and it must run on a Windows 7 workstation (32 and 64bit) without additional software!
Thanks.
you can use NETDOM.EXE tool on server
netdom query /domain:DOM fsmo
Where DOM is my Netbios domain name
You can use DSQUERY.EXE tool
dsquery server -hasfsmo schema
(the five roles are: schema, rid, name, infr and pdc)
Determining FSMO Role Holders seems to be a good source
(Edited)
Here is an example of VBScript doing that using ADSI.
To determine the PDC Master you must query the fSMORoleOwner attribute on the partition corresponding to your domain.
Here is a sample VBS (visit http://adcoding.com/ for more information):
Set objDomDn = GetObject("LDAP://dc=concorp,dc=contoso,dc=com")
strfsmoRoleOwner = objDomDn.Get("fsmoRoleOwner")
Set objPDCfsmo = GetObject("LDAP://" & strfsmoRoleOwner)
Set objPDCfsmoParent = GetObject(objPDCfsmo.Parent)
Wscript.Echo objPDCfsmoParent.Get("dnsHostName")
精彩评论