码迷,mamicode.com
首页 > 其他好文 > 详细

2010-查看五大角色

时间:2016-07-01 18:39:51      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:服务器   控制器   如图所示   客户端   角色   

在加入域的任意一台客户端或者服务器本身,双击运行vbs文件,即可显示五大角色的主控制器,如图所示:

技术分享


vbs内容如下:

Set objRootDSE = GetObject("LDAP://rootDSE")

Dim text

‘ Schema Master

Set objSchema = GetObject("LDAP://" & objRootDSE.Get("schemaNamingContext"))

strSchemaMaster = objSchema.Get("fSMORoleOwner")

Set objNtds = GetObject("LDAP://" & strSchemaMaster)

Set objComputer = GetObject(objNtds.Parent)

text="Forest-wide Schema Master FSMO: " & objComputer.Name & vbCrLf

Set objNtds = Nothing

Set objComputer = Nothing

‘ Domain Naming Master

Set objPartitions = GetObject("LDAP://CN=Partitions," & _

objRootDSE.Get("configurationNamingContext"))

strDomainNamingMaster = objPartitions.Get("fSMORoleOwner")

Set objNtds = GetObject("LDAP://" & strDomainNamingMaster)

Set objComputer = GetObject(objNtds.Parent)

text=text&"Forest-wide Domain Naming Master FSMO: " & objComputer.Name & vbCrLf

Set objNtds = Nothing

Set objComputer = Nothing

‘ PDC Emulator

Set objDomain = GetObject("LDAP://" & objRootDSE.Get("defaultNamingContext"))

strPdcEmulator = objDomain.Get("fSMORoleOwner")

Set objNtds = GetObject("LDAP://" & strPdcEmulator)

Set objComputer = GetObject(objNtds.Parent)

text=text&"Domain‘s PDC Emulator FSMO: " & objComputer.Name & vbCrLf

Set objNtds = Nothing

Set objComputer = Nothing

‘ RID Master

Set objRidManager = GetObject("LDAP://CN=RID Manager$,CN=System," & _

objRootDSE.Get("defaultNamingContext"))

strRidMaster = objRidManager.Get("fSMORoleOwner")

Set objNtds = GetObject("LDAP://" & strRidMaster)

Set objComputer = GetObject(objNtds.Parent)

text=text&"Domain‘s RID Master FSMO: " & objComputer.Name & vbCrLf

Set objNtds = Nothing

Set objComputer = Nothing

‘ Infrastructure Master

Set objInfrastructure = GetObject("LDAP://CN=Infrastructure," & _

objRootDSE.Get("defaultNamingContext"))

strInfrastructureMaster = objInfrastructure.Get("fSMORoleOwner")

Set objNtds = GetObject("LDAP://" & strInfrastructureMaster)

Set objComputer = GetObject(objNtds.Parent)

text=text&"Domain‘s Infrastructure Master FSMO: " & objComputer.Name & vbCrLf

WScript.Echo text



2010-查看五大角色

标签:服务器   控制器   如图所示   客户端   角色   

原文地址:http://dengw.blog.51cto.com/7143894/1794923

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!