Chinaunix首页 | 论坛 | 博客
  • 博客访问: 575779
  • 博文数量: 88
  • 博客积分: 7206
  • 博客等级: 少将
  • 技术积分: 1162
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-26 16:04
文章分类

全部博文(88)

文章存档

2011年(3)

2010年(24)

2009年(16)

2008年(45)

分类: WINDOWS

2008-08-20 17:04:05

Set objRootDSE = GetObject("")
' Schema Master
Set objSchema = GetObject("LDAP://" & objRootDSE.Get("schemaNamingContext"))
strSchemaMaster = objSchema.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strSchemaMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo "Forest-wide Schema Master FSMO: " & objComputer.Name
Set objNtds = Nothing
Set objComputer = Nothing
' Domain Naming Master
Set objPartitions = GetObject("," & _
objRootDSE.Get("configurationNamingContext"))
strDomainNamingMaster = objPartitions.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strDomainNamingMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo "Forest-wide Domain Naming Master FSMO: " & objComputer.Name
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)
WScript.Echo "Domain's PDC Emulator FSMO: " & objComputer.Name
Set objNtds = Nothing
Set objComputer = Nothing
' RID Master
Set objRidManager = GetObject(" Manager$,CN=System," & _
objRootDSE.Get("defaultNamingContext"))
strRidMaster = objRidManager.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strRidMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo "Domain's RID Master FSMO: " & objComputer.Name
Set objNtds = Nothing
Set objComputer = Nothing
' Infrastructure Master
Set objInfrastructure = GetObject("," & _
objRootDSE.Get("defaultNamingContext"))
strInfrastructureMaster = objInfrastructure.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strInfrastructureMaster)
Set objComputer = GetObject(objNtds.Parent)
WScript.Echo "Domain's Infrastructure Master FSMO: " & objComputer.Name
 
将上面的代码copy到记事本上,然后将记事本另存为vbs脚本文件,在机器上双击执行即可!
可以检测出5个FSMO角色所在的主机!
阅读(1212) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~